Overpass API/Python API

From OpenStreetMap Wiki
Jump to navigation Jump to search
Overpass Python API
Author: Martijn van Exel
License: Apache License 2.0 (free of charge)
Platform: Python
Version: 0.7.2 (2024-08-10)
Language:
English
Source code: https://github.com/mvexel/overpass-api-python-wrapper
Programming language: Python

Python 3.9+ API for Overpass

Features
Feature Value
Map Display
Display map ?
Map data ?
Source online
Rotate map ?
3D view ?
Shows website ?
Shows phone number ?
Shows operation hours ?
Routing
?
Navigating
?
Tracking
?
Monitoring
?
Editing
?
Rendering
?
Accessibility
?

A simple but powerful Python interface to the Overpass API.

Examples

Searching for all nodes named “Salt Lake City”

>>> import overpass
>>> api = overpass.API()
>>> response = api.get('node["name"="Salt Lake City"]')
>>> print [(
...     feature['properties']['name'],
...     feature['id']) for feature in response["features"]]
[(u'Salt Lake City', 150935219), (u'Salt Lake City', 585370637)]

This would output two nodes:

Other examples

You can find more examples and documentation on GitHub (see box)