hydromt.gis_utils.nearest#
- hydromt.gis_utils.nearest(gdf1: GeoDataFrame, gdf2: GeoDataFrame) Tuple[ndarray, ndarray] [source]#
Return the index of and distance [m] to the nearest geometry.
For Line geometries in gdf1 the nearest geometry is based line center point and for polygons on its representative point. Mixed geometry types are not yet supported.
Note: Since geopandas v0.10.0 it contains a sjoin_nearest method which is very similar and should.
- Parameters:
gdf1 (
geopandas.GeoDataFrame
) – Source gdf1 and destination gdf2 geometries.gdf2 (
geopandas.GeoDataFrame
) – Source gdf1 and destination gdf2 geometries.
- Returns:
index (
ndarray
) – index of nearest gdf2 geometrydst (
ndarray
offloat
) – distance to the nearest gdf2 geometry