Skip to content

geodalib / core/src / getLength

Function: getLength()

getLength(geoms, distanceUnit): Promise<number[]>

Defined in: core/src/geometry/attributes.ts:61

Get the length of the geometry

Parameters

geoms

SpatialGeometry

distanceUnit

DistanceUnit

Returns

Promise<number[]>

Example

ts
const geoms = [
  { type: 'Feature', geometry: { type: 'LineString', coordinates: [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]] }, properties: { index: 0 } },
];
const length = await getLength(geoms, DistanceUnit.KM);