I would like to use OSMnx to retrieve all edges of the same OSM way. I mean by way a collection of edges typically belonging to the same street (as defined in the OSM documentation here).
I manage to get the graph (of nodes and edges) using this kind of call:
import networkx as nx
import osmnx as ox
lat = 48.865306
lon = 2.327491
G = ox.graph_from_point(
(lat, lon),
dist=250,
)
G = ox.project_graph(G, to_latlong=True)
print(G)
fig, ax = ox.plot_graph(G, show=False, close=False)
ax.scatter(lon, lat, c='blue')
And to find the nearest edge from my position:
## Retrieve the nearest edge
ne_idx = ox.distance.nearest_edges(G, lon, lat)
print(ne_idx)
ne = G.edges[ne_idx]
print(ne)
## Find the nearest edge boundaries
(start, stop, key) = ne_idx
node_start = G.nodes(data=True)[start]
node_stop = G.nodes(data=True)[stop]
print(node_start)
print(node_stop)
## Plot
fig, ax = ox.plot_graph(G, show=False, close=False)
ax.scatter(lon, lat, c='blue')
ax.scatter(node_start['lon'], node_start['lat'], c='green')
ax.scatter(node_stop['lon'], node_stop['lat'], c='red')
But I did not find how to retrieve the list of all the edges belonging to the same way.
In the example above (centered on 48.865306, 2.327491), it would be “Rue de Rivoli” service highway.
Using JSOM (Display -> Advanced information), I can see that this way has the osmID # 1274070500 and includes 16 nodes. How can I find the same information with OSMnx?