You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am also wondering the same: I am pretty new to python (just landed to it) and I would like to make a query to Overpass and store the results in a geospatial format (e.g. GeoJSON).
importoverpyAPI=overpy.Overpass()
# Fetch highways within Granollers' city.result=API.query(""" area[name="Granollers"][admin_level=8]; // query part for: “highway=*” (way["highway"](area); relation["highway"](area); ); // print results out body; """)
Unfortunately, I am not familiar at all with python and I don't know how to store result as a GeoJSON file (Honestly, I don't even know what kind of thing result is -I tried with type(result) and I get overpy.Result as an output, which doesn't mean much to my poor knowledge). I have been reading overpy documentation but I haven't been able to figure it out.
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw str result returned from overpy to use as input for other tools like osmtogeojson
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw str result returned from overpy to use as input for other tools like osmtogeojson
osmium-tools with "export" command is not well known but do the same (osm to geojson) efficiently (c compiled).
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw str result returned from overpy to use as input for other tools like osmtogeojson
Activity
ccamara commentedon Mar 7, 2019
I am also wondering the same: I am pretty new to python (just landed to it) and I would like to make a query to Overpass and store the results in a geospatial format (e.g. GeoJSON).
After reading this documentation page I came up with the following code:
Unfortunately, I am not familiar at all with python and I don't know how to store
resultas a GeoJSON file (Honestly, I don't even know what kind of thingresultis -I tried withtype(result)and I getoverpy.Resultas an output, which doesn't mean much to my poor knowledge). I have been readingoverpydocumentation but I haven't been able to figure it out.diegocrzt commentedon Oct 2, 2019
There is a library to do osm to geojson osmtogeojson, but it requires to have the raw data (xml or json) as returned by Overpass API. I consider that doing geojson conversion is probably off-topic for overpy, but could be nice to have something like a raw
strresult returned fromoverpyto use as input for other tools likeosmtogeojsonclement-igonet commentedon Jan 20, 2021
osmium-tools with "export" command is not well known but do the same (osm to geojson) efficiently (c compiled).
marcelharing commentedon May 9, 2024
Overpass Python Wrapper gives back GEOJSON and also raw XML/JSON data in just a few lines of code.
https://github.com/mvexel/overpass-api-python-wrapper