geopandas.sindex.SpatialIndex.intersection

SpatialIndex.intersection(coordinates, *args, **kwargs)

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

Parameters
coordinatessequence or array

Sequence of the form (min_x, min_y, max_x, max_y) to query a rectangle or (x, y) to query a point.

Examples

>>> from shapely.geometry import Point, box
>>> s = geopandas.GeoSeries(geopandas.points_from_xy(range(10), range(10)))
>>> s
0    POINT (0.00000 0.00000)
1    POINT (1.00000 1.00000)
2    POINT (2.00000 2.00000)
3    POINT (3.00000 3.00000)
4    POINT (4.00000 4.00000)
5    POINT (5.00000 5.00000)
6    POINT (6.00000 6.00000)
7    POINT (7.00000 7.00000)
8    POINT (8.00000 8.00000)
9    POINT (9.00000 9.00000)
dtype: geometry
>>> s.sindex.intersection(box(1, 1, 3, 3).bounds)
array([1, 2, 3])

Alternatively, you can use query:

>>> s.sindex.query(box(1, 1, 3, 3))
array([1, 2, 3])