hydromt_delft3dfm.workflows.find_nearest_branch#

hydromt_delft3dfm.workflows.find_nearest_branch(branches: GeoDataFrame, geometries: GeoDataFrame, method: str = 'overal', maxdist: float = 5.0) GeoDataFrame[source]#

Determine the nearest branch for each geometry.

The method of determination can vary.

Parameters:
  • branches (gpd.GeoDataFrame) – Geodataframe containing branch geometries.

  • geometries (gpd.GeoDataFrame) – Geodataframe containing geometries for which the nearest branch needs to be found.

  • method (str, optional) – Method to determine the nearest branch. Supports: - ‘overal’: Find the nearest branch based on the geometry’s location. - ‘intersecting’: Convert the geometry to a centroid of its intersection points with branches. Default is ‘overal’.

  • maxdist (float, optional) – Maximum distance threshold for finding the nearest branch. Default is 5.0.

Returns:

Geodataframe with additional columns: - ‘branch_id’: ID of the nearest branch. - ‘branch_distance’: Distance to the nearest branch. - ‘branch_offset’: Offset along the branch.

Return type:

gpd.GeoDataFrame

Raises:

NotImplementedError – If the specified method is not among the allowed methods.