I have obtained a street network using a polygon, if you are interested in how to obtain the road network you want, you can check this post. I will check
0. Visualize the network and a bit of GeoDataframe
- Renaming the Nodes and Edges
- Accessing the neighbors/downstream roads, updating the neighbor info
- Validate the neighbor quantity
0. Visualize the network and a bit of GeoDataframe
import osmnx as ox
from shapely.geometry import Polygon
coords = [...see the complete coords at the end of this post]
poly = Polygon(coords)
graph = ox.graph_from_polygon(poly, network_type='drive',simplify=True)
ox.plot_graph(graph)
We can transform the network in the GeoDataframe using GeoPandas.
nodes, edges = ox.utils_graph.graph_to_gdfs(graph)