Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export xml #12

Open
gregmacfarlane opened this issue Apr 29, 2015 · 5 comments
Open

Export xml #12

gregmacfarlane opened this issue Apr 29, 2015 · 5 comments

Comments

@gregmacfarlane
Copy link

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.

@phibos
Copy link
Member

phibos commented Apr 29, 2015

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

@phibos phibos self-assigned this Apr 29, 2015
@gregmacfarlane
Copy link
Author

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

  1. downloads the file for the geography they want,
  2. queries the file to extract the highways that the network will use.

It seems overpy consolidates these two steps into a single convenient query, but I can't pass it on.

@gregmacfarlane
Copy link
Author

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!

@phibos phibos added this to the 0.4 milestone Apr 30, 2015
@dbuse
Copy link

dbuse commented May 3, 2015

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.

@phibos phibos modified the milestones: 0.5, 0.4 Dec 6, 2016
@phibos phibos added the idea label Dec 6, 2016
@SilvanaP
Copy link

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!

@phibos phibos removed this from the 0.5 milestone Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants