I need to make a graph with powerlines of europe then save it as graphml so later i can open it with yED. I've succeded to save graph as png but i need to save it as graphml. Below i paste example with Malta.
import osmnx as ox
import networkx as nx
import matplotlib.pyplot as plt
import geopandas as gpd
countries = ("Albania", "Andorra", "Austria", "Belarus", "Belgium", "Bosnia and Herzegovina", "Bulgaria", "Bulgaria",
"Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France",
"Germany", "United Kingdom", "Greece", "Hungary", "Iceland", "Ireland", "Italy", "Kosovo", "Latvia", "Liechtenstein", "Lithuania",
"Luxembourg", "Macedonia", "Malta", "Moldova", "Monaco", "Montenegro", "Netherlands", "Norway", "Poland",
"Portugal", "Romania", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland")
\#ox.settings.max_query_area_size = 25e12
electricity_lines = ox.graph_from_place(
'Malta',
custom_filter='\["power"="line"\]',
retain_all=True,
simplify=True,
truncate_by_edge=True,
buffer_dist=200,
clean_periphery=True
)
prj_elec = ox.project_graph(electricity_lines)
ox.save_graph_shapefile(prj_elec, filepath='C:/MALTA/MONACOMAP')
edges = gpd.read_file('C:/MALTA/MONACOMAP/edges.shp')
nodes = gpd.read_file('C:/MALTA/MONACOMAP/nodes.shp')
fig, ax = plt.subplots(figsize=(12, 8))
edges.plot(ax=ax)
nodes.plot(ax=ax, color='red', markersize=5)
plt.savefig('C:/MALTA/MONACOMAP/Czarnogora.png')
plt.show()
\#ox.save_graphml(G, filepath="./graph.graphml")