spatial-monorepo / wayfinding/src / geometryCentroid
Function: geometryCentroid()
geometryCentroid(
geometry):Position2D|undefined
Defined in: packages/wayfinding/src/graph.ts:173
Derive the centroid of a GeoJSON geometry.
- Point: the point itself.
- LineString / MultiPoint: arithmetic mean of all coordinate positions.
- Polygon: centroid of the outer ring.
- Everything else: first coordinate pair found.
Parameters
geometry
coordinates
unknown
type
string
Returns
Position2D | undefined
