2

In a route, we get a list of all the nodes from the source to destination.

route = nx.shortest_path(G,origin_node,desitination_node, weight='length')

Is it possible to get all the osm way ids from source to destination?

Isfand
  • 43
  • 5

1 Answers1

1

Yes, the route is a list of nodes. Iterate through this list pairwise to get edge (u, v) tuples (for instance see https://stackoverflow.com/a/4628446/7321942). Look up those edge tuples in the graph to get the constituent OSM way IDs corresponding to those edges.

gboeing
  • 5,691
  • 2
  • 15
  • 41