SpatialIndex
Parameters
np.array of Shapely geometries, GeoSeries, or PySparkDataFrame
required
str
default:"'strtree'"
The type of spatial index to use.
str
default:"None"
The column name to extract geometry from if
geometry is a PySparkDataFrame.is_empty
Returns
bool
True if the index is empty, False otherwise.
size
Returns
int
Number of geometries in the index.
valid_query_predicates
query predicate.
Added in version 2.0.0.
Returns
set
A new set containing
None, "intersects", and "contains".
None selects the default "intersects" behavior.intersection()
Parameters
tuple
required
Bounding box as (min_x, min_y, max_x, max_y).
Returns
list
List of geometries if constructed from a GeoSeries or PySparkDataFrame.
List of the corresponding indices if constructed from a np.array.
nearest()
Parameters
BaseGeometry
required
The geometry to find the nearest neighbor for.
int
default:"1"
Number of nearest neighbors to find.
bool
default:"False"
Whether to return distances along with indices.
Returns
list or tuple
List of geometries if constructed from a GeoSeries or PySparkDataFrame.
List of the corresponding indices if constructed from a np.array.
query()
Parameters
BaseGeometry
required
The geometry to query against the spatial index.
str
default:"None"
Spatial predicate to filter results. Must be either ‘intersects’ (default) or ‘contains’.
bool
default:"False"
Whether to sort the results.
Returns
list
List of geometries if constructed from a GeoSeries or PySparkDataFrame.
List of the corresponding indices if constructed from a np.array.

