hydromt.Dataset.vector.from_gdf#

static Dataset.vector.from_gdf(gdf, data_vars={}, coords=None, index_dim=None, keep_cols=True)#

Creates Dataset with geospatial coordinates. The Dataset values are reindexed to the gdf index.

Parameters:
  • gdf (geopandas GeoDataFrame) – Spatial coordinates. The index should match the df index and the geometry columun may only contain Point geometries. Additional columns are also parsed to the xarray DataArray coordinates.

  • data_vars (dict-like, DataArray or Dataset) – A mapping from variable names to xarray.DataArray objects. See xarray.Dataset for all options. Aditionally it accepts xarray.DataArray with name property and xarray.Dataset.

  • coords (sequence or dict of array_like, optional) – Coordinates (tick labels) to use for indexing along each dimension.

  • index_dim (str, optional) – Name of index dimension in data_vars

  • keep_cols (bool, optional) – If True, keep gdf columns as extra coordinates in dataset

Returns:

da – Dataset with geospatial coordinates

Return type:

xarray.Dataset