Centroid
One point per feature, at its geometric centre or, if asked, at a point guaranteed to lie inside it.
Pitfall. The centroid of a concave or multipart polygon can fall outside it; use inside for labels and joins back to the polygon.
Pitfall. Centroids of data in a geographic CRS are computed on degrees and are slightly off the true centre on the ground.
| Also called | Feature To Point, centroids, point on surface, representative point, label point |
|---|---|
| Group | vector/geometry |
| Checks | geometry.valid |
| Pitfalls | 2 listed above |
| Columbus tool | Not stated |
| Notes | Not stated |
| Status | active |
| Broader | Not stated |
| Narrower | Not stated |
| Related |
Parameters
| Name | Type | Required | Default | Values | Note |
|---|---|---|---|---|---|
inside | boolean | no | no | Not stated | Use a point guaranteed to lie inside each polygon (point on surface) instead of the centroid. |
Inputs and outputs
| Direction | Name | Type | Geometry | Note |
|---|---|---|---|---|
| Input | layer | vector | Not stated | Not stated |
| Output | output | vector | point | Not stated |
In each engine
| Engine | Tool | Parameters | Differences |
|---|---|---|---|
apache-sedona | sedona.sql.ST_Centroid |
|
|
apache-sedona | sedona.sql.ST_PointOnSurface |
|
|
geopandas | geopandas.GeoSeries.centroid |
|
|
geopandas | geopandas.GeoSeries.representative_point |
|
|
postgis | st_centroid |
|
|
postgis | st_pointonsurface |
| None noted |
qgis | native:centroids |
|
|
qgis | native:pointonsurface |
|
|
sf | sf::st_centroid |
|
|
sf | sf::st_point_on_surface |
| None noted |
shapely | shapely.centroid |
| None noted |
shapely | shapely.point_on_surface |
| None noted |
terra | terra::centroids |
| None noted |
turf-js | turf.centroid |
|
|
turf-js | turf.pointOnFeature |
|
|
whiteboxtools | CentroidVector |
| None noted |