0

Following the example (https://github.com/gboeing/osmnx-examples/blob/main/notebooks/04-simplify-graph-consolidate-nodes.ipynb)

1st - grab an arbitrary location and graph around it, plot it with the nodes colored red.

import osmnx as ox

# get a street network and plot it with all edge intersections
point = 37.858495, -122.267468
G = ox.graph_from_point(point, network_type="drive", dist=500)
fig, ax = ox.plot_graph(G, node_color="r")

Results is an image with a collection of streets and nodes in red enter image description here

Continuing on with the example, attempting to simplify/consolidate the intersections where the nodes are "close" and should actually reflect 1 intersection.

G_proj = ox.project_graph(G)
G2 = ox.consolidate_intersections(G_proj, rebuild_graph=True, tolerance=15, dead_ends=False)
fig, ax = ox.plot_graph(G2, node_color="r")

Results in an image where the "close enough" nodes have been combined into a single "intersection" (some of the red dots have combined now into a single dot), however the setting dead_ends=False doesn't actually seem to remove (all) the nodes from the end of dead end streets, as you can still see 6 still identified in red. It does look like it removed 2 of the original 7 nodes that are on dead-end streets, but it seems to have removed the edge associated with those streets (top left and bottom right) and in the one case it eliminated the node and edge, but left the preceding street as a dead end street with a node (bottom right).

enter image description here

Question: Is there another modification required to remove the node at the end of a dead end street, is this the desired/correct output from the consolidate_intersections, and probably most importantly is there a better/more efficient way to attain OSM street/road/path/highway intersections (only) and exclude the end of a dead-end street?

Biaspoint
  • 505
  • 3
  • 19

1 Answers1

0

I think I am starting to understand this now, it appears to be working properly. Those streets are not actually dead-end streets (well not all of them), they are just the end of the requested map, or the last node on that street before the map ends. This is an artifact of trying to create a minimum example and not fully understanding the difference between the minimum example and the much larger area where I first started to see an issue.

There does seem to be some inconsistencies, but that might be attributable to OSM and not osmnx? Here is the actual OSM view of the lower-middle where a few "dead-end" streets/nodes were removed:

enter image description here

Those are roads that are definitely connected, but perhaps because they have additional paths, they have additional "intersections" and through the osmnx consolidate_intersections function they are combined... but for some reason they resulting "nodes" meet the criteria for dead-end street and are removed? regardless, the functionality appears to work and I misunderstood the map as part of the original problem.

Here are zoomed in views of all 3 were a node was incorrectly removed: Initial, with all nodes, looks like the intersections were already not connected from the initial graph_from_point.

enter image description here

After consolidate_intersections (tolerance =15), notice that the traffic circle is reduced a single intersection, but 2 edges are incorrectly removed.

enter image description here

Actual OSM view:

enter image description here

Biaspoint
  • 505
  • 3
  • 19