I need to download vehicle network only from OSM, and have the ouput be as normal .osm file, that can then be used in OSMnx (that would be the same or similar, as if i did osmnx.graph_from_place('Piedmont, CA, USA', network_type='drive')
), i tried using OSMnx to do exactly this and save the graph as .osm, but SUMO is missing most nodes and edges when loaded from this file, so i need something that can do this, while preserving the original .osm file structure, but being only vehicle network (if possible using python).
I've read: https://www.researchgate.net/publication/334767256_Road_network_extraction_with_OSMNx_and_SUMOPy
but i cant figure out, how to use SUMOpy and convert the files as shown in the image.
We usually use osmfilter, for instance to get just the main roads:
osmfilter input.osm --keep-ways="highway=primary =primary_link =secondary =secondary_link =trunk =trunk_link =motorway =motorway_link" --keep-nodes= --keep-relations= > output.osm