Skip to main content

STRTreeRef

Class representing a (STR) R-tree that exists in the Wasm memory.

STRTree is a query-only R-tree spatial index structure for two-dimensional data that uses Sort-Tile-Recursive packing algorithm.

To create new index use strTreeIndex function.

Type Parameters

  • G - The type of indexed geometry

Properties

geometries readonly

G[]

The original geometries that were indexed by the tree. This array is readonly and should not be modified.

detached optional

boolean

Object becomes detached when manually freed. Detached objects are no longer valid and should not be used.

Methods

query

(geometry: Geometry) -> G[]

Returns all geometries whose bounding box intersects with the query geometry's bounding box.

nearest

(geometry: Geometry) -> G | undefined

Returns the geometry with the minimum distance to the query geometry.

nearestAll

(geometry: Geometry) -> G[]

Returns all geometries with the minimum distance to the query geometry.

free

() -> void

Frees the Wasm memory allocated for the STRTree object.