Перечислите отсутствующие OSMids и нанесите их на пурпурный
place = {'city' : 'Modena', 'country' : 'Italia'}
#--------SOME BASIC SETTINGS FOR PLOTTING------
one_way = (0.863, 0.039, 0.173,1)
two_way = (0.243, 0.243, 0.243,1)
background = (0.973, 0.973, 0.973,1)
#--------PLOT GRAPH WITHOUT SPECIFYING THE NETWORK TYPE AND GET THE OSMIDs---------
G = ox.graph_from_place(place)
osmid_no_network = list([data['osmid'] for u, v, key, data in G.edges(keys=True, data=True)])
ec = [one_way if data['oneway'] else two_way for u, v, key, data in G.edges(keys=True, data=True)]
fig, ax = ox.plot_graph(G, bgcolor=background,
show=False, close=True, fig_height=11, fig_width=11, node_size = 0, edge_linewidth = 0.1, edge_color = ec, dpi=300)
fig.suptitle("Modena_no_network_type")
plt.show()
ox.plot.save_and_show(fig, ax, save=True, show=False, close=True, filename = "Modena_no_network_type",
file_format="png", dpi=300, axis_off=True)
#--------PLOT GRAPH SPECIFYING THE NETWORK TYPE = WALK AND GET THE OSMIDs-------
H = ox.graph_from_place(place, network_type = 'walk')
osmid_network_walk = list([data['osmid'] for u, v, key, data in H.edges(keys=True, data=True)])
ec = [one_way if data['oneway'] else two_way for u, v, key, data in H.edges(keys=True, data=True)]
fig, ax = ox.plot_graph(H, bgcolor=background,
show=False, close=True, fig_height=11, fig_width=11, node_size = 0, edge_linewidth = 0.1, edge_color = ec, dpi=300)
fig.suptitle("Modena_network_walk")
plt.show()
ox.plot.save_and_show(fig, ax, save=True, show=False, close=True, filename = "Modena_network_walk",
file_format="png", dpi=300, axis_off=True)
#--------GET THE OSMIDs LIST OF MISSING EDGES AND PLOT MISSING EDGES IN MAGENTA---------
missing_edges = [i for i in osmid_no_network + osmid_network_walk if i not in osmid_no_network or i not in osmid_network_walk]
print(missing_edges)
m_edges = (0.859, 0.180, 0.938, 1)
ec2 = [m_edges if data['osmid'] in missing_edges else two_way for u, v, key, data in G.edges(keys=True, data=True)]
fig, ax = ox.plot_graph(G, bgcolor=background,
show=False, close=True, fig_height=11, fig_width=11, node_size = 0, edge_linewidth = 0.1, edge_color = ec2, dpi=300)
fig.suptitle("Modena_missing_edges")
plt.show()
ox.plot.save_and_show(fig, ax, save=True, show=False, close=True, filename = "Modena_missing_edges", file_format="png", dpi=300, axis_off=True)