This excellent post had an example of an overpass query: https://help.openstreetmap.org/questions/19063/get-city-nodes-within-a-country-using-overpass-api Using Python, I can query OSM for all cities in Belgium:
but I can't do similar for powerplants. Does anyone know why? Code below returns empty dictionary.
Thanks again asked 23 Jun '16, 20:16 jdills26 |
It seems there simply aren't any power plants modeled as nodes there. There are ways: answered 23 Jun '16, 22:30 maxerickson 2
Out center may not work with overpass Python wrapper, there are some issues on that topic on github.
(24 Jun '16, 07:12)
mmd
Thanks alot for this! With this code I am still getting an error (below). I'm able to get power plants and power generators when I specify a bounding box, but I'd like a more efficient way to get country data from the API.
KeyError Traceback (most recent call last) <ipython-input-96-529c6ed17161> in <module>() 1 C:\Users\julia.dills\AppData\Local\Continuum\Anaconda3\lib\site-packages\overpass\api.py in _asGeoJSON(self, elements) 129 elif elem_type == "way": 130 points = [] --> 131 for coords in elem["geometry"]: 132 points.append((coords["lon"], coords["lat"])) 133 geometry = geojson.LineString(points) KeyError: 'geometry'
(02 Jul '16, 20:53)
jdills26
1
I've noticed you've changed the output to That leaves us with the question, why you want to stick with overpass-api-python-wrapper. There's plenty of more mature alternatives out there, it all depends on what you're trying to achieve.
(03 Jul '16, 19:31)
mmd
|
Duplicate post: https://github.com/mvexel/overpass-api-python-wrapper/issues/59
Exactly the same error message was posted here. I'm proposing to close this one and continue on stack overflow instead.