System Requirements
- python 3.8
- networkx - pip install networkx
- matplotlib - pip install matplotlib
- GDAL - pip install C:\Software\GDAL-3.0.4-cp38-cp38-win_amd64.whl
- street-network shapefile - Streets.shp
import networkx as nx # pip install networkx
import matplotlib.pyplot as plt # pip install matplotlib
G=nx.read_shp('C:\\Streets.shp') # pip install C:\Software\GDAL-3.0.4-cp38-cp38-win_amd64.whl
pos = {k: v for k,v in enumerate(G.nodes())}
X=nx.Graph() #Empty graph
X.add_nodes_from(pos.keys()) #Add nodes preserving coordinates
l=[set(x) for x in G.edges()] #To speed things up in case of large objects
edg=[tuple(k for k,v in pos.items() if v in sl) for sl in l] #Map the G.edges start and endpoints onto pos
nx.draw_networkx_nodes(X,pos,node_size=10,node_color='b')
X.add_edges_from(edg)
nx.draw_networkx_edges(X,pos)
plt.xlim(-8232250, -8228920) #Th