momepy.consolidate_intersections(graph, tolerance=30, rebuild_graph=True, rebuild_edges_method='spider', x_att='x', y_att='y', edge_from_att='from', edge_to_att='to')[source]#

Consolidate close street intersections into a single node, collapsing short edges.

If rebuild_graph is True, new edges are drawn according to rebuild_edges_method which is one of:

  1. Extension reconstruction:

    Edges are linearly extended from original endpoints until the new nodes. This method preserves most faithfully the network geometry but can result in overlapping geometry.

  2. Spider-web reconstruction:

    Edges are cropped within a buffer of the new endpoints and linearly extended from there. This method improves upon linear reconstruction by mantaining, when possible, network planarity.

  3. Euclidean reconstruction:

    Edges are ignored and new edges are built as straight lines between new origin and new destination. This method ignores geometry, but efficiently preserves adjacency.

If rebuild_graph is False, graph is returned with consolidated nodes but without reconstructed edges i.e. graph is intentionally disconnected.

Graph must be configured so that

  1. All nodes have attributes determining their x and y coordinates;

  2. All edges have attributes determining their origin, destination, and geometry.

graphNetworkx.Graph, Networkx.DiGraph, Networkx.MultiGraph, or


tolerancefloat, default 30

distance in network units below which nodes will be consolidated


‘extend’ or ‘spider’ or ‘euclidean’, ignored if rebuild_graph is False


node attribute with the valid x-coordinate


node attribute with the valid y-coordinate


edge attribute with the valid origin node id


edge attribute with the valid destination node id

Networkx.MultiGraph or Networkx.MultiDiGraph

directionality inferred from input type