Spatial index#

GeoPandas will use the STRtree implementation provided by the Shapely (shapely.STRtree)

GeoSeries.sindex creates a spatial index, which can use the methods and properties documented below.



Generate the spatial index

Spatial index object#

The spatial index object returned from GeoSeries.sindex has the following methods:


Compatibility wrapper for rtree.index.Index.intersection, use query instead.


Check if the spatial index is empty

nearest(geometry[, return_all, ...])

Return the nearest geometry in the tree for each input geometry in geometry.

query(geometry[, predicate, sort, distance])

Return the integer indices of all combinations of each input geometry and tree geometries where the bounding box of each input geometry intersects the bounding box of a tree geometry.


Size of the spatial index


Returns valid predicates for the spatial index.

The spatial index offers the full capability of shapely.STRtree.