turf.centroid
How Turf.js runs Centroid: turf.centroid.
| Engine | Turf.js |
|---|---|
| Tool name | turf.centroid |
| Interface | js |
| Implements | Centroid |
| Documentation | Not stated |
| Effects | modifies input: no, network: no |
| Notes | From @turf/centroid. |
| Status | active |
Parameters
| Name | Type | Required | Default | Choices | Note |
|---|---|---|---|---|---|
geojson | AllGeoJSON | yes | Not stated | Not stated | Not stated |
options | { properties?: P; } | no | Not stated | Not stated | Not stated |
options.properties | P | no | Not stated | Not stated | field of options |
How it maps to the operation
| Operation parameter | Parameter here | Note |
|---|---|---|
layer | geojson | Not stated |
inside | Not stated | always no. Use turf.pointOnFeature for a point inside the polygon. |
Differences from the operation
- The mean of all vertices, not the area-weighted centroid (turf.centerOfMass gives that).
- Turf works on GeoJSON in longitude/latitude (WGS 84); data in another CRS must be reprojected first.
Harvested by the turf harvester from engine version
7.4.0. Names can change when an engine is harvested again.