Create groups of edges that are crossing the river in nearby locations, using a density-based clustering method (DBSCAN). This is to make sure that edges representing e.g. different lanes of the same street are treated as part of the same crossing. For each cluster, select the shortest edge.
filter_clusters(crossings, river, eps = 100)An object of class sf::sfc_LINESTRING including the shortest edge
per cluster
Crossing edge geometries as a simple feature object
The river geometry as a simple feature object
DBSCAN parameter referring to the size (radius) distance of the neighborhood. Should approximate the distance between edges that we want to consider as a single river crossing