mvexel / overpass-api-python-wrapper

Python bindings for the OpenStreetMap Overpass API
Apache License 2.0
360 stars 89 forks source link

Is it possible to get the boundary coordinates? #73

Closed ssilwa closed 5 years ago

ssilwa commented 7 years ago

The overpass API mentions that it is possible to get the boundary coordinates of a location, for example, a city. I cannot figure out how to do this through this python module. Can anyone help me?

trypy commented 7 years ago

Added following example under a fork: https://github.com/trypy/overpass-api-python-wrapper/blob/d921bf95b54a91fd7827ae34205665640d7d4a19/examples/boundary_nodes_city_ISO3166-1_US.py

Please let me know if helpful. Only tested one city.

fsj-digital commented 6 years ago

loooks great - dar trypy thaks for sharing

mvexel commented 6 years ago

Can you supply an example Overpass query @ssilwa ?

mvexel commented 6 years ago

I think you mean out bb?

You can do this today with a raw query:

>>> import overpass
>>> api = overpass.API()
>>> resp = api.get("""[out:json];relation[name="Amsterdam"];out bb;""", build=False, responseformat="json")
>>> resp["elements"][0]["bounds"]

I realize that responseformat="json" seems redundant -- this is addressed in another ticket (#93)

mvexel commented 5 years ago

I think my answer addresses OPs issue, but haven't heard back. I will close this but please re-open if you have additional questions @ssilwa.