79687877

Date: 2025-07-02 17:55:51
Score: 1
Natty:
Report link

I tried the solution proposed by @gboeing, and it worked well. I created a list of nodes that do not belong to bridges, then built a dictionary assigning a tolerance to each of those nodes. Any node that is not included in the list is automatically assigned a tolerance of 0.

I'm sharing the code below in case it's helpful to others.

Thanks!

set_nodes = set(G.nodes)

bridge_nodes = []
for u, v, bridge in G.edges.data("bridge"):  
    if bridge == 'yes':
            bridge_nodes.append(u)
            bridge_nodes.append(v)

set_bridge_nodes = set(bridge_nodes)
other_nodes = set_nodes.difference(set_bridge_nodes)

tolerance_other_nodes = {k:30 for k in other_nodes}

intersections = ox.consolidate_intersections(G, rebuild_graph=True, tolerance=tolerance_other_nodes, dead_ends=False)
Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-1): it worked
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @gboeing
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Catarina Costa