Skip to main content

geometry_centroid

Function geometry_centroid 

Source
pub fn geometry_centroid(geometry: &Geometry) -> Option<GeoCoord>
Expand description

Centroid of a geometry.

  • Point – the point itself.
  • LineString – midpoint weighted by segment length.
  • Polygon – area-weighted centroid of the exterior ring.
  • Multi* – weighted average of component centroids.
  • GeometryCollection – unweighted mean of non-empty children.

Returns None for empty geometries.