API reference#

The API reference provides an overview of all public objects, functions and methods and Xarray accessors implemented in Xvec.

Indexing#

GeometryIndex(index[, crs])

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

GeometryIndex.crs

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

GeometryIndex.sindex

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

Dataset.xvec#

Properties#

Dataset.xvec.geom_coords

Returns a dictionary of xarray.DataArray objects corresponding to coordinate variables composed of shapely.Geometry objects.

Dataset.xvec.geom_coords_indexed

Returns a dictionary of xarray.DataArray objects corresponding to coordinate variables using GeometryIndex.

Methods#

Dataset.xvec.set_geom_indexes(coord_names[, ...])

Set a new GeometryIndex for one or more existing coordinate(s).

Dataset.xvec.is_geom_variable(name[, has_index])

Check if coordinate variable is composed of shapely.Geometry.

Dataset.xvec.set_crs([variable_crs, ...])

Set the Coordinate Reference System (CRS) of coordinates backed by GeometryIndex.

Dataset.xvec.to_crs([variable_crs])

Transform shapely.Geometry objects of a variable to a new coordinate reference system.

Dataset.xvec.query(coord_name, geometry[, ...])

Return a subset of a DataArray/Dataset filtered using a spatial query on GeometryIndex.

Dataset.xvec.to_geodataframe(*[, name, ...])

Convert this array and its coordinates into a tidy geopandas.GeoDataFrame.

Dataset.xvec.to_geopandas()

Convert this array into a GeoPandas GeoDataFrame

Dataset.xvec.extract_points(points, ...[, ...])

Extract points from a DataArray or a Dataset indexed by spatial coordinates

Dataset.xvec.zonal_stats(geometry, x_coords, ...)

Extract the values from a dataset indexed by a set of geometries

DataArray.xvec#

Properties#

DataArray.xvec.geom_coords

Returns a dictionary of xarray.DataArray objects corresponding to coordinate variables composed of shapely.Geometry objects.

DataArray.xvec.geom_coords_indexed

Returns a dictionary of xarray.DataArray objects corresponding to coordinate variables using GeometryIndex.

Methods#

DataArray.xvec.set_geom_indexes(coord_names)

Set a new GeometryIndex for one or more existing coordinate(s).

DataArray.xvec.is_geom_variable(name[, ...])

Check if coordinate variable is composed of shapely.Geometry.

DataArray.xvec.to_crs([variable_crs])

Transform shapely.Geometry objects of a variable to a new coordinate reference system.

DataArray.xvec.set_crs([variable_crs, ...])

Set the Coordinate Reference System (CRS) of coordinates backed by GeometryIndex.

DataArray.xvec.query(coord_name, geometry[, ...])

Return a subset of a DataArray/Dataset filtered using a spatial query on GeometryIndex.

DataArray.xvec.to_geodataframe(*[, name, ...])

Convert this array and its coordinates into a tidy geopandas.GeoDataFrame.

DataArray.xvec.to_geopandas()

Convert this array into a GeoPandas GeoDataFrame

DataArray.xvec.extract_points(points, ...[, ...])

Extract points from a DataArray or a Dataset indexed by spatial coordinates

DataArray.xvec.zonal_stats(geometry, ...[, ...])

Extract the values from a dataset indexed by a set of geometries