Skip to content

GeoRust Series

geopolars.GeoRustSeries dataclass

Operations to be done via GeoRust native algorithms

area property

area: pl.Series

Returns a Series containing the area of each geometry in the GeoSeries expressed in the units of the CRS.

See also
Notes

Area may be invalid for a geographic CRS using degrees as units; use to_crs to project geometries to a planar CRS before using this function.

centroid property

centroid: GeoSeries

Returns a GeoSeries of points representing the centroid of each geometry.

Note that centroid does not have to be on or within original geometry.

Returns:

  • GeoSeries

    New GeoSeries with centroids.

geom_type property

geom_type: pl.Series

Returns a Series of strings specifying the Geometry Type of each object.

x property

x: pl.Series

Return the x location of point geometries in a GeoSeries

See Also

y

Returns:

  • pl.Series

    Series with x values

y property

y: pl.Series

Return the y location of point geometries in a GeoSeries

See Also

x

Returns:

  • pl.Series

    Series with y values

affine_transform

affine_transform(
    matrix: list[float] | AffineTransform,
) -> GeoSeries

Returns a GeoSeries with translated geometries.

See Shapely's affine_transform or Rust's [AffineOps][rust_docs] for details.

Parameters:

  • matrix (list[float] | AffineTransform) –

    The 6 parameter matrix is [a, b, d, e, xoff, yoff]

Returns:

  • GeoSeries

    New GeoSeries with translated geometries.

convex_hull

convex_hull() -> GeoSeries

Returns a GeoSeries of geometries representing the convex hull of each geometry.

The convex hull of a geometry is the smallest convex Polygon containing all the points in each geometry, unless the number of points in the geometric object is less than three. For two points, the convex hull collapses to a LineString; for 1, a Point.

See also

distance

distance(other: GeoSeries) -> GeoSeries

Returns a Series containing the distance to aligned other.

Distance is cartesian distance in 2D space, and the units of the output are in terms of the CRS of the two input series. The operation works on a 1-to-1 row-wise manner.

Parameters:

  • other (GeoSeries) –

    The series to which calculate distance in 1-to-1 row-wise manner.

Returns:

  • GeoSeries

    GeoSeries containing the distance from each element to the element in

  • GeoSeries

    other.

envelope

envelope() -> GeoSeries

Returns a GeoSeries of geometries representing the envelope of each geometry.

The envelope of a geometry is the bounding rectangle. That is, the point or smallest rectangular polygon (with sides parallel to the coordinate axes) that contains the geometry.

See also

convex_hull: convex hull geometry

euclidean_length

euclidean_length() -> pl.Series

Returns a Series containing the euclidean length of each geometry expressed in the units of the CRS.

See also

area: measure area of a polygon

Notes

Length may be invalid for a geographic CRS using degrees as units; use GeoSeries.to_crs to project geometries to a planar CRS before using this function.

exterior

exterior() -> GeoSeries

Returns a GeoSeries of LinearRings representing the outer boundary of each polygon in the GeoSeries.

geodesic_length

geodesic_length(
    method: GeodesicMethod = "geodesic",
) -> polars.Series

Returns a Series containing the geodesic length of each geometry expressed in meters.

Parameters:

  • method (GeodesicMethod) –

    Method for calculating length: one of 'geodesic', 'haversine', or 'vincenty'.

    'geodesic' uses the geodesic measurement methods given by Karney (2013). As opposed to older methods like Vincenty, this method is accurate to a few nanometers and always converges. 'vincenty' uses Vincenty's formulae. 'haversine' uses the haversine formula.

Returns:

  • polars.Series

    [Series][polars.Series] containing the geodesic length of each geometry

expressed in meters.

See also

area: measure area of a polygon

Notes

This method is only meaningful for input data as longitude/latitude coordinates on the WGS84 ellipsoid (i.e. EPSG:4326).

Length may be invalid for a geographic CRS using degrees as units; use GeoSeries.to_crs to project geometries to a planar CRS before using this function.

is_empty

is_empty() -> pl.Series

Returns a Series of dtype('bool') with value True for empty geometries.

is_ring

is_ring() -> pl.Series

Returns a Series of dtype('bool') with value True for features that are closed.

rotate

rotate(
    angle: float, origin: TransformOrigin = "center"
) -> GeoSeries

Returns a GeoSeries with rotated geometries.

See Shapely's rotate or Rust's [Rotate][rust_docs] for details.

Parameters:

  • angle (float) –

    float The angle of rotation in degrees. Positive angles are counter-clockwise and negative are clockwise rotations.

  • origin (TransformOrigin) –

    string or tuple (x, y) The point of origin can be a keyword 'center' for the bounding box center (default), 'centroid' for the geometry's centroid, or a coordinate tuple (x, y).

scale

scale(
    xfact: float = 1.0,
    yfact: float = 1.0,
    origin: TransformOrigin = "center",
) -> GeoSeries

Returns a GeoSeries with scaled geometries.

The geometries can be scaled by different factors along each dimension. Negative scale factors will mirror or reflect coordinates.

See Shapely's scale or Rust's [Scale][rust_docs] for details.

xfact: Scaling factors for the x dimension. yfact: Scaling factors for the y dimension.

The point of origin can be a keyword 'center' for the 2D bounding

box center (default), 'centroid' for the geometry's 2D centroid or a coordinate tuple (x, y).

skew

skew(
    xs: float = 0.0,
    ys: float = 0.0,
    origin: TransformOrigin = "center",
) -> GeoSeries

Returns a GeoSeries with skewed geometries.

The geometries are sheared by angles along the x and y dimensions.

See Shapely's skew or Rust's [Skew][rust_docs] for details.

xs: The shear angle for the x axis in degrees. ys: The shear angle for the y axis in degrees.

The point of origin can be a keyword 'center' for the bounding box

center (default), 'centroid' for the geometry's centroid or a coordinate tuple (x, y).

Returns:

  • GeoSeries

    GeoSeries with skewed geometries.

translate

translate(
    xoff: float = 0.0, yoff: float = 0.0
) -> GeoSeries

Returns a GeoSeries with translated geometries.

See Shapely's translate or Rust's Translate for details.

Parameters:

  • xoff (float) –

    Amount of offset along the x dimension.

  • yoff (float) –

    Amount of offset along the y dimension.