Skip to content

getCoordinatesFromGeometry

getCoordinatesFromGeometry(g): Coordinate[]

Defined in: src/geometry.ts:58

Extracts all coordinates from a geometry object, flattening nested structures. Handles geometry collections and all geometry types, returning a flat array of coordinates.

Geometry

The OpenLayers geometry to extract coordinates from

Coordinate[]

Flat array of coordinate arrays

const line = new LineString([[0,0], [1,1], [2,2]])
const coords = getCoordinatesFromGeometry(line) // Returns [[0,0], [1,1], [2,2]]