Open gregmacfarlane opened 9 years ago
At the moment it is not possible to export the data(Result()
). But I like the idea and it might help to decrease the time to create a proof of concept.
Are you looking for a way to export the data in the OSM-XML format? http://wiki.openstreetmap.org/wiki/OSM_XML
That's exactly what I want right now.
What I need eventually is a graph/network xml that can be read by MATSim, a Java-based transportation simulator. MATSim includes classes that read an OSM-XML file and convert it into a network file that it can use, a process described here.
Basically, I'm trying to find a way to automate/code the first couple of parts in that process, where the user
It seems overpy
consolidates these two steps into a single convenient query, but I can't pass it on.
Of course another solution for me would be to write the code to turn the OSM data into a usable network directly in python. But that's my problem, not yours!
As a workaround you can simply fire your queries (in xml or overpass query language) at the overpass-interpreter (e.g. http://overpass-api.de/api/interpreter) using wget, curl etc and save the file.
Alternatively you can build xml structures quickly using pythons built-in xml libs. I am currently working on a very similar project extracting data from OSM for the SUMO simulator.
However, being able to export overpy results to xml (or json) would be quite advantageous.
Hello, 07b638a has a bug in line 62, it writes out the node id but it should be the way id - I commented also directly under the file in more detail. Otherwise the script works great, thanks!
Is there a way to write the
Result
object to an XML file as it might come from geofabrik? Eventually I'd like to write code that would process the downloaded data directly, but right now I'm just trying to pull custom query that I can feed into something else.