Skip to content
This repository was archived by the owner on Jun 10, 2025. It is now read-only.

mvexel/overpass-api-python-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overpass API python wrapper

This is a thin wrapper around the OpenStreetMap Overpass API.

Use it

You need to have the requests module installed.

>>> 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)]

Parameters

The API takes a few parameters:

endpoint

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)

timeout

The default timeout is 25 seconds, but you can set it to whatever you want.

api = Overpass.API(timeout=600)

debug

Setting this to True will get you debug output.

Need help? Want feature?

Create a new issue.

Fork it

Yes please. Help wanted.

About

Python bindings for the OpenStreetMap Overpass API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 25

Languages