hydromt.model.components.GeomsComponent#

class hydromt.model.components.GeomsComponent(model: Model, *, filename: str = 'geoms/{name}.geojson', region_component: str | None = None, region_filename: str = 'geoms/geoms_region.geojson')[source]#

A component to manage geo-spatial geometries.

It contains a dictionary of geopandas GeoDataFrames.

Initialize a GeomsComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The path to use for reading and writing of component data by default. by default “geoms/{name}.geojson” ie one file per geodataframe in the data dictionary.

  • region_component (str, optional) – The name of the region component to use as reference for this component’s region. If None, the region will be set to the union of all geometries in the data dictionary.

  • region_filename (str) – The path to use for writing the region data to a file. By default “geoms/geoms_region.geojson”.

__init__(model: Model, *, filename: str = 'geoms/{name}.geojson', region_component: str | None = None, region_filename: str = 'geoms/geoms_region.geojson')[source]#

Initialize a GeomsComponent.

Parameters:
  • model (Model) – HydroMT model instance

  • filename (str) – The path to use for reading and writing of component data by default. by default “geoms/{name}.geojson” ie one file per geodataframe in the data dictionary.

  • region_component (str, optional) – The name of the region component to use as reference for this component’s region. If None, the region will be set to the union of all geometries in the data dictionary.

  • region_filename (str) – The path to use for writing the region data to a file. By default “geoms/geoms_region.geojson”.

Methods

__init__(model, *[, filename, ...])

Initialize a GeomsComponent.

read([filename])

Read model geometries files at <root>/<filename>.

set(geom, name)

Add data to the geom component.

test_equal(other)

Test if two GeomsComponents are equal.

write([filename, to_wgs84])

Write model geometries to a vector file (by default GeoJSON) at <root>/<filename>.

write_region(*[, filename, to_wgs84])

Write the model region to file.

Attributes

bounds

Return the total bounds of the model region.

crs

Provide access to the CRS of the model region.

data

Model geometries.

data_catalog

Return the data catalog of the model this component is associated with.

model

Return the model object this component is associated with.

region

Provide access to the underlying GeoDataFrame data of the model region.

root

Return the root of the model this component is associated with.