mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
360 stars 89 forks source link

Unnecessary `(._;>;);` #92

Closed pe-perry closed 6 years ago

pe-perry commented 6 years ago

The following query doesn't work unless (._;>;); is added, but it is not necessary (if I just want way data).

resp = api.get('rel(3676782);map_to_area->.lantauisland;way(area.lantauisland);')

Error message:

Traceback (most recent call last): File "python", line 1, in UnboundLocalError: local variable 'geometry' referenced before assignment

The problem also occurs for relations.

Note that http://overpass-api.de/api/interpreter?data=[out:json];rel(3676782);map_to_area->.lantauisland;rel(area.lantauisland);out; does return a json of way data.

mvexel commented 6 years ago

If you amend the query call to specify the response format as JSON, you should be fine.

>>> resp = api.get('rel(3676782);map_to_area->.lantauisland;way(area.lantauisland);', responseformat="json")

Let me know if that works!

pe-perry commented 6 years ago

@mvexel Thanks! It works after adding responseformat="json". So interesting.