xvec.GeometryIndex#

class xvec.GeometryIndex(index, crs=None)#

An CRS-aware, Xarray-compatible index for vector geometries.

This index can be set from any 1-dimensional coordinate of (shapely 2.0) shapely.Geometry elements.

It provides all the basic functionality of an xarray.indexes.PandasIndex. In addition, it allows spatial filtering based on geometries (powered by shapely.STRtree).

Parameters
indexxarray.indexes.PandasIndex

An Xarray (pandas) index built from an array-like of shapely.Geometry objects.

crspyproj.crs.CRS or any, optional

The coordinate reference system. Any value accepted by pyproj.crs.CRS.from_user_input().

Attributes
crs

Returns the coordinate reference system of the index as a pyproj.crs.CRS object.

sindex

Returns the spatial index, i.e., a shapely.STRtree object.

Methods

to_pandas_index()

Cast this xarray index to a pandas.Index object or raise a TypeError if this is not supported.

concat

copy

create_variables

equals

from_variables

isel

join

reindex_like

rename

roll

sel

stack

unstack

__init__(index, crs=None)#

Methods

__init__(index[, crs])

concat(indexes, dim[, positions])

copy([deep])

create_variables([variables])

equals(other)

from_variables(variables, *, options)

isel(indexers)

join(other[, how])

reindex_like(other[, method, tolerance])

rename(name_dict, dims_dict)

roll(shifts)

sel(labels[, method, tolerance])

stack(variables, dim)

to_pandas_index()

Cast this xarray index to a pandas.Index object or raise a TypeError if this is not supported.

unstack()

Attributes

crs

Returns the coordinate reference system of the index as a pyproj.crs.CRS object.

sindex

Returns the spatial index, i.e., a shapely.STRtree object.