[GIS] Is it possible to get OSM data in geojson via overpass api using ipython

apigeojsonipythonopenstreetmapoverpass-api

I am looking for a solution that works with the overpass api.

for example:

http://overpass-api.de/api/interpreter?data=[out:geojson];area(3600225494);(node(area)[%22amenity%22~%22theatre|cinema|arts_centre%22];);out%20body;

When trying this approach I get an error that says

"Error: line 1: static error: For the attribute "output" of the
element "osm-script" the only allowed values are "xml", "json", "csv",
"custom", or "popup"."

Therefore GeoJSON is not supported this way.

I tried several approaches in ipython (python 2.7) to transform json into geojson, but failed so far.

What I need is a way to get OSM as geojson in ipython via using a url (e.g. overpass api).

BR

Best Answer

Overpass API doesn't support GeoJSON. You have to perform the conversion from JSON to GeoJSON yourself.

For converting JSON into GeoJSON see this answer. It even contains a solution in Python. Another Python solution is contained in this answer.

Related Question