This is a thin wrapper around the OpenStreetMap Overpass API.
$ python setup.py install
The module is not on PyPi yet.
>>> from overpass import Overpass
>>> api = Overpass.API()
>>> response = api.Get('node["name"="Salt Lake City"]')
Note that you don't have to include any of the output meta statements. The wrapper will, well, wrap those.
You will get your result as a dictionary, which (for now) represents the JSON output you would get from the Overpass API directly. So you could do this for example:
>>> print [(feature['tags']['name'], feature['id']) for feature in response['elements']]
[(u'Salt Lake City', 150935219), (u'Salt Lake City', 585370637), (u'Salt Lake City', 1615721573)]
The API takes a few parameters:
The default endpoint is http://overpass-api.de/api/interpreter
but you can pass in the rambler instance (http://overpass.osm.rambler.ru/cgi/interpreter
) or your own:
api = Overpass.API(endpoint=http://overpass.myserver/interpreter)
The default timeout is 25 seconds, but you can set it to whatever you want.
api = Overpass.API(timeout=600)
Setting this to True
will get you debug output.
This takes a list in the form [minlon, minlat, maxlon, maxlat]
, the default is the world: [-180.0, -90.0, 180.0, 90.0]
Create a new issue.
py.test
There are almost no tests yet.