geoHelpers

Namespace

geoHelpers

Description:
  • Helper functions for working with geographic data.

Source:

Methods

(static) flattenGeometryRings(geometry) → {object}

Description:
  • Helper function to flatten geometry rings. Flattens nested coordinate arrays to simplify processing.

Source:
Example
const geometry = flattenGeometryRings({
  coordinates: [[[0, 0], [10, 0]], [[10, 10], [0, 10]]]
});
console.log(geometry.coordinates); // [[0, 0], [10, 0], [10, 10], [0, 10]]
Parameters:
Name Type Description
geometry object

Geometry object containing coordinates.

Returns:

A geometry object with flattened coordinates.

Type
object