3

I'd like to collect forest data on overpass turbo. But my code isn't working properly. Here is the first version:

import overpass

api = overpass.API()

res = api.get("""
 area[name="Charente-Maritime"]->.searchArea;
 (
 way[landuse=forest](area.searchArea);
 relation[landuse=forest](area.searchArea);;
 way[natural=wood](area.searchArea);
 relation[natural=wood](area.searchArea);
 );
 (._;>;);
 out body;
""")

Here's the error message:

Traceback (most recent call last):
  File "D:/3_PROJETS/00_TD/TD7-analyse_spatiale/02_TRAVAIL/forest.py", line 16, in <module>
    """)
  File "C:\python35\lib\site-packages\overpass\api.py", line 130, in get
    return self._as_geojson(response["elements"])
  File "C:\python35\lib\site-packages\overpass\api.py", line 214, in _as_geojson
    raise UnknownOverpassError("Received corrupt data from Overpass (incomplete polygon).")
overpass.errors.UnknownOverpassError: Received corrupt data from Overpass (incomplete polygon).

I've tried many different syntaxes but none of them have worked so far.

1 Answer 1

2

Your query has a syntax error, namely an extra semicolon in the following line, which needs to be removed.

relation[landuse=forest](area.searchArea);;

Before trying any queries in Python, better test them in overpass turbo first, until they work correctly.

2
  • I have the same error message for this request: rel["name"="Noues de Sienne"](46.081,-5.438,50.121,0.439); which does work in overpass turbo. Any idea ? Commented May 8, 2020 at 15:56
  • Looking at the current code there is a check that I just do not need. I will work on that. Commented May 8, 2020 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.