pygeos.strtree

class pygeos.strtree.STRtree(geometries, leafsize=5)

Bases: object

A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm.

For two-dimensional spatial data. The actual tree will be constructed at the first query.

Parameters

geometries : array_like

leafsize : int

the maximum number of child nodes that a node can have

Examples

>>> import pygeos
>>> geoms = pygeos.points(np.arange(10), np.arange(10))
>>> tree = pygeos.STRtree(geoms)
>>> tree.query(pygeos.box(2, 2, 4, 4)).tolist()
[2, 3, 4]

Attributes

Methods

__init__(geometries, leafsize=5)

Initialize self. See help(type(self)) for accurate signature.

__weakref__

list of weak references to the object (if defined)

query(envelope)

Return all items whose extent intersect the given envelope.

Parameters

envelope : Geometry

The envelope of the geometry is taken automatically.