Skip to content

geodalib / core/src / spatialJoin

Function: spatialJoin()

spatialJoin(__namedParameters): Promise<number[][]>

Defined in: core/src/geometry/spatial-join.ts:34

Spatial join two geometries. The result is an array of arrays, where each sub-array contains the indexes of the geometries (right) that intersect.

Parameters

__namedParameters

SpatialJoinProps

Returns

Promise<number[][]>

Example

ts
const leftGeometries = [
  { type: 'Feature', geometry: { type: 'Polygon', coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]] }, properties: { index: 0 } },
];
const rightGeometries = [
  { type: 'Feature', geometry: { type: 'Polygon', coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]] }, properties: { index: 1 } },
];
const joinIndexes = await spatialJoin({ leftGeometries, rightGeometries });