emsarray.operations.geometry
emsarray.operations.geometry#
- emsarray.operations.geometry.to_geojson(dataset)#
Make a
geojson.FeatureCollection
out of the cells in this dataset, one feature per cell.Each feature will include the linear index and the native index of the corresponding cell in its properties.
- Parameters
dataset (
xr.Dataset
) – The dataset to export as GeoJSON geometry.- Returns
geojson.FeatureCollection
– The geometry of this dataset as a FeatureCollection.
See also
- emsarray.operations.geometry.write_geojson(dataset, path)#
Export the geometry of this dataset to a GeoJSON file as a
geojson.FeatureCollection
with one feature per cell.Each feature will include the linear index and the native index of the corresponding cell in its properties.
- Parameters
dataset (
xr.Dataset
) – The dataset to export as GeoJSON geometry.path (
str
orpathlib.Path
) – The path where the geometry should be written to.
See also
- emsarray.operations.geometry.write_shapefile(dataset, target=None, *, shp=None, shx=None, dbf=None, prj=None, **kwargs)#
Write the geometry of this dataset to a Shapefile. Each polygon is saved as an individual record with
name
,linear_index
, andindex
fields.- Parameters
dataset (
xarray.Dataset
) – The dataset to export the geometry for.target (
str
orpathlib.Path
, optional) – Where to save the shapefile. The names for the .shp, .shx, .dbf, and .prj files are derived from this. Optional, you can instead provide arguments for each individual file.shp, shx, dbf, prj (
str
orpathlib.Path
oropened file handle
) – Where to write the individual shapefile components to. Optional, you can instead provide the base path astarget
.**kwargs – An extra keyword arguments are passed on to the shapefile.Writer instance.