1

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

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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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