cartagen.collapse_junctions

cartagen.collapse_junctions#

collapse_junctions(network, threshold)#

Collapse road junctions using hierarchical clustering.

This algorithm, proposed by Mackaness and Mackechnie [1], simplifies road intersections by grouping nearby nodes using a single-linkage clustering method. For each cluster, topological connectivity is analyzed to identify independent road groups (connected components). Each component is then collapsed toward its specific centroid, preserving the network’s functional topology while removing micro-segments.

Parameters:
  • network (GeoDataFrame of LineString) – The road network to simplify.

  • threshold (float) – The maximum distance (in the network’s coordinate system units) to group nodes together into a single cluster.

Returns:

GeoDataFrame of LineString – The simplified road network with collapsed junctions and updated geometries.

Notes

The algorithm first performs a spatial clustering to identify potential junctions. Within each spatial cluster, it builds a graph to ensure that only nodes that are physically connected are collapsed together, avoiding artificial connections between nearby but disconnected layers (e.g., overpasses).

References

(Source code)

../_images/collapse_junctions.png