hydromt.data_catalog.drivers.GeoDataFrameTableDriver#
- pydantic model hydromt.data_catalog.drivers.GeoDataFrameTableDriver[source]#
Driver for GeoDataFrame from tabular formats:
geodataframe_table.Supports reading point geometries from csv, excel (xls, xlsx), and parquet files using a combination of the pandas and geopandas libraries.
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.
- SUPPORTED_EXTENSIONS: ClassVar[set[str]] = {'.csv', '.parquet', '.xls', '.xlsx'}#
“Set of supported file extensions for this driver.
- field options: GeoDataFrameTableOptions [Optional]#
Driver options that can be used to configure the behavior of the driver. DriverOptions allows for setting arbitrary kwargs. Any options not explicitly declared in the DriverOptions class are passed as kwargs to the underlying open functions.
- 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 tabular geospatial data (CSV, Excel, or Parquet) into a GeoDataFrame.
Supports reading point geometries from tabular sources using latitude and longitude columns. Coordinates are mapped to geometry based on configured dimension names or detected automatically from the column headers.
- Parameters:
uris (
list[str]) – List of URIs to read data from. Only one file is supported per read operation.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) – Unused in this driver. Present for interface consistency.variables (
str | list[str] | None, optional) – Unused in this driver. Present for interface consistency.
- Returns:
The loaded geospatial data.
- Return type:
gpd.GeoDataFrame- Raises:
ValueError – If multiple URIs are provided.
Warning
The mask and variables parameters are not used directly in this driver, but are included for consistency with the GeoDataFrameDriver interface.
- write(path: Path | str, data: GeoDataFrame, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write a GeoDataFrame to disk.
Writing is not supported for this driver, as tabular sources (CSV, Excel, Parquet) are typically read-only in this context. This method is included to maintain consistency with the GeoDataFrameDriver interface.
- Parameters:
path (
Path | str) – Destination path or URI where the GeoDataFrame would be written.data (
gpd.GeoDataFrame) – The GeoDataFrame to write.write_kwargs (
dict[str,Any], optional) – Additional keyword arguments that would be passed to the underlying write function. Default is None.
- Returns:
The path where the GeoDataFrame would be written.
- Return type:
Path- Raises:
NotImplementedError – Always raised, as writing is not supported for this driver.