Search code examples
sumo

Is it possible to convert osm data to net.xml format using netconvert in .py code?


I have to create a road network in SUMO. Network is not constant and relative big.

I would like to create a function for a dynamic creation of sumo road network based on OSM data. I am not sure if is it possible at all, but my basic algorithm is:

  1. Query OSM via Overpass API (or smth like this) using list of OSM-ids and get data of roads I am interesting in

  2. Story response in a variable

  3. Call smth like netconvert osm-import. And this should be not from file (.osm -> .net.xml) but from dynamic variable (2): (variable data -> net.xml)

Actually I am not sure it is possible. Could you please at least give some hints?


Solution

  • Currently it is not possible to do this without an intermediate file. Not even workarounds like a named pipe will do because netconvert reads the input file twice.