mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
367 stars 90 forks source link

Get nodes within country borders #59

Closed jdills26 closed 7 years ago

jdills26 commented 8 years ago

Hi,

Thanks so much for this excellent repo! I am trying to build a database of power plants from Open Street Map. This is the code I'm using:

import overpass
api = overpass.API(timeout=900)
response = api.Get('node["power" = "plant"]')
print(response)

I'm getting a nested dictionary of power plants, but only 187. I suspect there must be many more. Is there a better way to query? I eventually want to help build a database of power plants by country from Open Street Map and welcome any help on how to query by country as well.

Thank you so much!!

Frankkkkk commented 8 years ago

Hi,

Per taginfo, there are indeed 187 nodes with power=plant. There are also many ways (surely closed), though; you should check them too. Don't forget the relations !

Cheers, Frank

Skippern commented 8 years ago

I would actually turn that search around, to get what country (countries) a certain node, way, relation or bbox is within, but I guess that kind of search need to be implemented in the Overpass API before we can see results here.

You can search by country if you know the relation ID for the corresponding boundary relation for that country. And you can build a search that give you the correct relation ID if you know their names.

mvexel commented 7 years ago

Does not seem to be an issue related to the wrapper specifically. Feel free to reopen if you disagree!