hydromt.data_catalog.drivers.GeoDataFrameDriver#
- pydantic model hydromt.data_catalog.drivers.GeoDataFrameDriver[source]#
Abstract Driver to read GeoDataFrames.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- abstract read(uris: list[str], *, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, metadata: SourceMetadata | None = None, mask: Any = None, variables: str | list[str] | None = None) GeoDataFrame[source]#
Read geospatial data into a GeoDataFrame.
- Parameters:
uris (
list[str]) – List of URIs to read data from.handle_nodata (
NoDataStrategy, optional) – Strategy to handle missing or empty data. Default is NoDataStrategy.RAISE.metadata (
SourceMetadata | None, optional) – Optional metadata object describing the dataset source (e.g. CRS).mask (
Any, optional) – Optional spatial mask to filter the data. The mask can be a geometry, GeoDataFrame, or any geometry-like object depending on driver support.variables (
str | list[str] | None, optional) – Optional variable(s) or column(s) to read from the source file.
- Returns:
The loaded geospatial data.
- Return type:
gpd.GeoDataFrame
- abstract write(path: Path | str, data: GeoDataFrame, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write a GeoDataFrame to disk.
This abstract method defines the interface for all geospatial data drivers. Subclasses should implement logic for writing to supported vector formats (e.g., GeoPackage, Shapefile, GeoJSON).
- Parameters:
path (
Path | str) – Destination path or URI where the GeoDataFrame will be written.data (
gpd.GeoDataFrame) – The GeoDataFrame to write.write_kwargs (
dict[str,Any], optional) – Additional keyword arguments passed to the underlying write function (e.g., pyogrio.write_dataframe). Default is None.
- Returns:
The path where the data was written.
- Return type:
Path