Skip to content

Top-level functions

geoarrow.rust.core

area builtin

area(input: ArrowArrayExportable) -> Float64Array

Unsigned planar area of a geometry array

Parameters:

Returns:

signed_area builtin

signed_area(input: ArrowArrayExportable) -> Float64Array

Signed planar area of a geometry array

Parameters:

Returns:

center builtin

center(input: ArrowArrayExportable) -> PointArray

Compute the center of geometries

This first computes the axis-aligned bounding rectangle, then takes the center of that box

Parameters:

Returns:

centroid builtin

centroid(input: ArrowArrayExportable) -> PointArray

Calculation of the centroid.

The centroid is the arithmetic mean position of all points in the shape. Informally, it is the point at which a cutout of the shape could be perfectly balanced on the tip of a pin.

The geometric centroid of a convex object always lies in the object. A non-convex object might have a centroid that is outside the object itself.

Parameters:

Returns:

chaikin_smoothing builtin

chaikin_smoothing(input: ArrowArrayExportable, n_iterations: int) -> LineStringArray | PolygonArray | MultiLineStringArray | MultiPolygonArray

Smoothen LineString, Polygon, MultiLineString and MultiPolygon using Chaikins algorithm.

Chaikins smoothing algorithm

Each iteration of the smoothing doubles the number of vertices of the geometry, so in some cases it may make sense to apply a simplification afterwards to remove insignificant coordinates.

This implementation preserves the start and end vertices of an open linestring and smoothes the corner between start and end of a closed linestring.

Parameters:

  • input (ArrowArrayExportable) –

    input geometry array

  • n_iterations (int) –

    Number of iterations to use for smoothing.

Returns:

chamberlain_duquette_unsigned_area builtin

chamberlain_duquette_unsigned_area(input: ArrowArrayExportable) -> Float64Array

Calculate the unsigned approximate geodesic area of a Geometry.

Parameters:

Returns:

chamberlain_duquette_signed_area builtin

chamberlain_duquette_signed_area(input: ArrowArrayExportable) -> Float64Array

Calculate the signed approximate geodesic area of a Geometry.

Parameters:

Returns:

convex_hull builtin

convex_hull(input: ArrowArrayExportable) -> PolygonArray

Returns the convex hull of a Polygon. The hull is always oriented counter-clockwise.

This implementation uses the QuickHull algorithm, based on Barber, C. Bradford; Dobkin, David P.; Huhdanpaa, Hannu (1 December 1996) Original paper here: www.cs.princeton.edu/~dpd/Papers/BarberDobkinHuhdanpaa.pdf

Parameters:

Returns:

densify builtin

densify(input: ArrowArrayExportable, max_distance: float) -> LineStringArray | PolygonArray | MultiLineStringArray | MultiPolygonArray

Return a new linear geometry containing both existing and new interpolated coordinates with a maximum distance of max_distance between them.

Note: max_distance must be greater than 0.

Parameters:

Returns:

envelope builtin

envelope(input: ArrowArrayExportable) -> RectArray

Computes the minimum axis-aligned bounding box that encloses an input geometry

Parameters:

Returns:

  • RectArray

    Array with axis-aligned bounding boxes.

is_empty builtin

is_empty(input: ArrowArrayExportable) -> BooleanArray

Returns True if a geometry is an empty point, polygon, etc.

Parameters:

Returns:

geodesic_area_signed builtin

geodesic_area_signed(input: ArrowArrayExportable) -> Float64Array

Determine the area of a geometry on an ellipsoidal model of the earth.

This uses the geodesic measurement methods given by Karney (2013).

Assumptions
  • Polygons are assumed to be wound in a counter-clockwise direction for the exterior ring and a clockwise direction for interior rings. This is the standard winding for geometries that follow the Simple Feature standard. Alternative windings may result in a negative area. See "Interpreting negative area values" below.
  • Polygons are assumed to be smaller than half the size of the earth. If you expect to be dealing with polygons larger than this, please use the unsigned methods.
Units
  • return value: meter²
Interpreting negative area values

A negative value can mean one of two things: 1. The winding of the polygon is in the clockwise direction (reverse winding). If this is the case, and you know the polygon is smaller than half the area of earth, you can take the absolute value of the reported area to get the correct area. 2. The polygon is larger than half the planet. In this case, the returned area of the polygon is not correct. If you expect to be dealing with very large polygons, please use the unsigned methods.

Parameters:

Returns:

geodesic_area_unsigned builtin

geodesic_area_unsigned(input: ArrowArrayExportable) -> Float64Array

Determine the area of a geometry on an ellipsoidal model of the earth. Supports very large geometries that cover a significant portion of the earth.

This uses the geodesic measurement methods given by Karney (2013).

Assumptions
  • Polygons are assumed to be wound in a counter-clockwise direction for the exterior ring and a clockwise direction for interior rings. This is the standard winding for geometries that follow the Simple Features standard. Using alternative windings will result in incorrect results.
Units
  • return value: meter²

Parameters:

Returns:

geodesic_perimeter builtin

geodesic_perimeter(input: ArrowArrayExportable) -> Float64Array

Determine the perimeter of a geometry on an ellipsoidal model of the earth.

This uses the geodesic measurement methods given by Karney (2013).

For a polygon this returns the sum of the perimeter of the exterior ring and interior rings. To get the perimeter of just the exterior ring of a polygon, do polygon.exterior().geodesic_length().

Units
  • return value: meter

Returns:

simplify builtin

simplify(input: ArrowArrayExportable, epsilon: float) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray

Simplifies a geometry.

The Ramer–Douglas–Peucker algorithm simplifies a linestring. Polygons are simplified by running the RDP algorithm on all their constituent rings. This may result in invalid Polygons, and has no guarantee of preserving topology.

Multi* objects are simplified by simplifying all their constituent geometries individually.

An epsilon less than or equal to zero will return an unaltered version of the geometry.

Parameters:

Returns:

simplify_vw builtin

simplify_vw(input: ArrowArrayExportable, epsilon: float) -> PointArray | LineStringArray | PolygonArray | MultiPointArray | MultiLineStringArray | MultiPolygonArray

Returns the simplified representation of a geometry, using the Visvalingam-Whyatt algorithm

See here for a graphical explanation

Polygons are simplified by running the algorithm on all their constituent rings. This may result in invalid Polygons, and has no guarantee of preserving topology. Multi* objects are simplified by simplifying all their constituent geometries individually.

An epsilon less than or equal to zero will return an unaltered version of the geometry.

Parameters:

Returns: