mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
367 stars 90 forks source link

search returning empty objects #61

Closed Skippern closed 2 years ago

Skippern commented 8 years ago

Something have changed in either the code or the API since April/2016. A script that was working fantastically in April (and maybe in May) are only returning empty strings. Search queries [out:json];relation["type"="boundary"]["admin_level"="2"]["boundary"="administrative"](-34.0,-51.0,5.0,-28.0); and [out:json];relation["type"="boundary"]["admin_level"="2"]["boundary"="administrative"](-34.0,-51.0,5.0,-28.0);out body; and [out:json];relation["type"="boundary"]["admin_level"="2"]["boundary"="administrative"](-34.0,-51.0,5.0,-28.0);(._;>;);out body; all give empty response object back from the api. Running the last search in overpass-turbo returns correctly, the boundary relation for Brazil with all members. When the script was working, the first query sentence gave only the relation object of Brazil, which is what I need for further processing.

No changes have been done to the script since last successful run (except swapping between different alternatives of the searchString variable), though the PIP and the python version have been updated.

Below is a snippet from my log of the execution of the script:

2016/07/08 16:14:24: gpxupload INFO - Opened success.gpx/Upload/156VIRB0245.gpx 2016/07/08 16:14:24: gpxupload DEBUG - GPX File contains 1038 trackpoints with 1.423 km. 2016/07/08 16:14:24: gpxupload DEBUG - [out:json];relation["type"="boundary"]["adminlevel"="2"]"boundary"="administrative";(.;>;);out body; 2016/07/08 16:14:25: requests.packages.urllib3.connectionpool INFO - Starting new HTTP connection (1): overpass-api.de 2016/07/08 16:14:39: requests.packages.urllib3.connectionpool DEBUG - "POST /api/interpreter HTTP/1.1" 400 461 2016/07/08 16:14:39: gpxupload ERROR - No search result returned

rafaelcanovas commented 8 years ago

Can confirm.

Running with Python 3.4.3 and Overpass 0.4.0.

Tried with overpy, the exact same query, and it returned results.

Skippern commented 8 years ago

Python 2.7.12 and overpass 0.4.0

For some reason py3 executables seems to disappear on this computer....

I'll do another attempt to run this with py3 later today

Skippern commented 8 years ago

Got python 3.4 working, but my script is written for python 2.7, need to rewrite the string handling for py3 to test further. Opened a repo for this, see skippern/gpxupload#1

Skippern commented 8 years ago

I have tried to clean up the syntax, but continue to return empty queries, like {u'elements': [], u'version': 0.6, u'osm3s': {u'timestamp_osm_base': u'29553', u'timestamp_areas_base': u'29532', u'copyright': u'The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.'}, u'generator': u'Overpass API'}, while running the exact same query in overpass turbo gives the desired result.

Skippern commented 8 years ago

Actually, I found that [out:json];is_in;relation["type"="boundary"]["boundary"="administrative"]["admin_level"="2"](-20.836510,-40.923237,-20.412126,-40.494160);out tags; returns empty object in overpass-turbo as well, while [out:json];is_in;relation["type"="boundary"]["boundary"="administrative"]["admin_level"="8"](-20.836510,-40.923237,-20.412126,-40.494160);out tags; gives empty in python, while returns some results (expected result) in overpass-turbo.

mechy2k2000 commented 7 years ago

Hey Im getting emtpy returns as well when I want json BUT When i do XML format I get expected results but in xml :(

i.e. api = overpass.API() api.Get("relation(11111111)") # returns {"features": [], "type": "FeatureCollection"}

while api.Get("relation(11111111)", "xml") # returns expected data. works with "json" as well

hope this helps

mvexel commented 6 years ago

Relation 11111111 does not exist (any more). Could you give an example of a relation that does exist that has this behavior?

mvexel commented 6 years ago

I'm suspecting that querying for non-existing objects causes the issue, since no further comments were added to this since.. Will leave open for @Skippern to weigh in

mvexel commented 2 years ago

Closing for lack of activity. Feel free to re-open if you're still seeing this issue.