strTreeIndex
Constructs a 2D R-tree spatial index using Sort-Tile-Recursive (STR) packing algorithm.
The index is query-only; once constructed, geometries cannot be added or removed from the index.
The tree indexes the bounding boxes of each geometry. Geometries of any type can be indexed, types can mix within one index. Empty geometries are ignored during indexing and will never be returned by queries.
Type Parameters
G- The type of indexed geometry
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
geometries | G[] | The array of geometries to be indexed | |
options? | object | Optional options object | |
options.nodeCapacity? | number | 10 | The maximum number of child nodes that a tree node may have. The minimum recommended capacity value is 4. |
Returns
STRTreeRef<G>
A new STRTreeRef instance
Throws
GEOSErrorwhenoptions.nodeCapacityis less than 2