hydromt.data_catalog.DataCatalog.get_geodataframe#

DataCatalog.get_geodataframe(data_like: str | SourceSpecDict | Path | Dataset | DataArray, bbox: List | None = None, geom: GeoDataFrame | None = None, buffer: float | int = 0, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, variables: List | str | None = None, predicate: str = 'intersects', provider: str | None = None, version: str | None = None, **kwargs) GeoDataFrame | None[source]#

Return a clipped and unified GeoDataFrame (vector).

To clip the data to the area of interest, provide a bbox or geom, with optional additional buffer and align arguments. To return only the dataframe columns of interest provide the variables argument.

Parameters:
  • data_like (str, Path, gpd.GeoDataFrame) – Data catalog key, path to vector file or a vector geopandas object. The catalog key can be a string or a dictionary with the following keys: {‘name’, ‘provider’, ‘version’}. If a path to a vector file is provided it will be added to the catalog with its based on the file basename.

  • bbox (array-like of floats) – (xmin, ymin, xmax, ymax) bounding box of area of interest (in WGS84 coordinates).

  • geom (geopandas.GeoDataFrame/Series,) – A geometry defining the area of interest.

  • buffer (float, optional) – Buffer around the bbox or geom area of interest in meters. By default 0.

  • handle_nodata (NoDataStrategy, optional) – How to handle no data values, by default NoDataStrategy.RAISE

  • predicate (optional) – If predicate is provided, the GeoDataFrame is filtered by testing the predicate function against each item. Requires bbox or mask. By default ‘intersects’ options are: {‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’, ‘touches’},

  • align (float, optional) – Resolution to align the bounding box, by default None

  • variables (str or list of str, optional.) – Names of GeoDataFrame columns to return. By default all columns are returned.

  • provider (str, optional) – Data source provider. If None (default) the last added provider is used.

  • version (str, optional) – Data source version. If None (default) the newest version is used.

  • **kwargs – Additional keyword arguments that are passed to the GeoDataFrameAdapter function. Only used if data_like is a path to a vector file.

Returns:

gdf – GeoDataFrame. If no data is found and handle_nodata is set to IGNORE None will be returned. if it is set to RAISE and exception will be raised in that situation

Return type:

Optional[geopandas.GeoDataFrame]