I am new to this osmnx python lib. I want to know angle deviation between points. So, I tried to know lon-lan coordinates from OSM points ID. But I cannot do it. Anyone to tell me how to get coordinates from OSM points ID?
If I understand correctly, you're asking how to use OSMnx to retrieve the lat-long coordinates of a set of OSM node IDs in some graph. First create your graph. As it is a networkx multidigraph, you can use any of the built-in networkx methods to access your node attributes. Alternatively, as stated in its documentation, you can use OSMnx to dump your nodes to a geopandas GeoDataFrame and work with it pandas-style:
import osmnx as ox
G = ox.graph_from_place('Piedmont, California, USA', network_type='drive')
nodes = ox.graph_to_gdfs(G, edges=False)
nodes[['x', 'y']]
The resulting nodes
GeoDataFrame is indexed by OSM ID and contains x
and y
values representing the nodes' longitude and latitude. See also this question/answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With