Closed wendellwt closed 3 years ago
My work-around was in the conversion to GeoJSON polygon; if "points[-1] != points[0]" then collect the points and call it a MultiLineString. FYI, overpass/api.py diff is attached. api.py.diff.txt
It appears that this library is broken. See https://gis.stackexchange.com/questions/361978/overpass-api-python-wrapper-incomplete-polygon-error/362044 that proposes
import requests
from osmtogeojson import osmtogeojson
# Should use [out:json] in the query as later osmtogeojson does not parse XML
query = """
[out:json][timeout:25];
(way["building"](47.35436014253597,8.490386538763183,47.39245772996116,8.57950135269201);
relation["building"](47.35436014253597,8.490386538763183,47.39245772996116,8.57950135269201);
);
out body;
>;
out skel qt;
"""
url = "http://overpass-api.de/api/interpreter"
r = requests.get(url, params={'data': query})
result = osmtogeojson.process_osm_json(r.json())
as an alternative
I encountered an identical issue, fixed it here: https://github.com/mvexel/overpass-api-python-wrapper/pull/129
Thanks for the PR, @luftj !
I have the same issue, and I don't see how #129 can possibly fix this. The set is never accessed.
I noticed an issue with polygons that I don't understand, and it results in "Received corrupt data from Overpass (incomplete polygon)."
It is the Smithsonian Institution Building on the National Mall in downtown Washington DC, which is this Rel: https://www.openstreetmap.org/relation/7393969 It shows up properly when using the native OSM web page.
It is a Relation, is tagged as a Multipolygon, and is actually made up of 3 individual ways, each of which form a portion of the outline of the building.
Is this a problem with the OSM data itself? Is it ok for OSM data to be one Rel, which consists of multiple Ways that when combined together, form a complete polygon (closed way)?
It seems challenging to form the individual way (segments) into a complete proper GeoJSON Polygon structure. I don't need it to draw as a GeoJSON Polygon; individual LineStrings would work as long as the exception isn't raised.
Using "verbosity='body center'" doesn't seem to get around the problem. Is there any other query parameter that will get around this multiple-way polygon problem?
Anyway, thank you for this API.
Wendell