I used the Python library OSMNx to draw an optimal route between several steps of a city trip. The final variable is a list of OSM ids.
Now, I'm trying to save this route as a shp or json files. The problem is that I need for that the latitude/longitude of each node, but I didn't found an OSMNx function to do that.
I tried get_route_edge_attributes (but coordinates are not a valid attribute for this function). There is any way to get coordinates of an OSM node with this single id ?
Thanks in advance.
解决方案
you have all the attribute of each node and edge in the Graph. you can get node attributes using:
G.node[38862848]
#out: {'highway': nan,
# 'lat': 45.3210533,
# 'lon': -122.9790558,
# 'osmid': '38862848',
# 'ref': nan,
# 'x': 501641.478