NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

This excellent post had an example of an overpass query:

Using Python, I can query OSM for all cities in Belgium:

import overpass api = overpass.API(timeout=900) cities = api.Get('area[name="België - Belgique - Belgien"];(node[place="city"](area););out;') print(cities)

but I can't do similar for powerplants. Does anyone know why? Code below returns empty dictionary.

api = overpass.API(timeout=900) power = api.Get('area[name="België - Belgique - Belgien"];(node[power="plant"](area););out;') print(power)

Thanks again

asked 23 Jun '16, 20:16

jdills26's gravatar image

accept rate: 0%


Exactly the same error message was posted here. I'm proposing to close this one and continue on stack overflow instead.

(05 Jul '16, 08:27) mmd

It seems there simply aren't any power plants modeled as nodes there. There are ways:

permanent link

answered 23 Jun '16, 22:30

maxerickson's gravatar image

accept rate: 32%


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.

x=api.Get('area[name="België - Belgique - Belgien"];(way["power"="plant"](area);); out skel;') x

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\ 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

I've noticed you've changed the output to out skel;. Unfortunately, that's also not going to cut it, as the result doesn't include any coordinates or geometry information. out center; is not supported by the overpass python wrapper, i.e. @maxerickson's suggestion is good in general, but does not apply in this particular case.

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 23 Jun '16, 20:16

question was seen: 5,381 times

last updated: 05 Jul '16, 08:27

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum