Skip to content

geodalib / core/src / getCentroids

Function: getCentroids()

getCentroids(geoms): Promise<(null | number[])[]>

Defined in: core/src/geometry/centroid.ts:22

Get the centroids of the geometries

Example

ts
const geoms = [
  {
    type: 'Feature',
    geometry: { type: 'Point', coordinates: [100, 0] },
  },
];

const centroids = await getCentroids(geoms);

Parameters

geoms

SpatialGeometry

The geometries to get the centroids. See SpatialGeometry

Returns

Promise<(null | number[])[]>

The centroids of the geometries