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 |
||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||
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:
- 150935219, representing the label for the
place =cityrelation named Salt Lake City - 585370637, a now-deleted node representing a
landuse =quarrynamed Salt Lake City
Other examples
You can find more examples and documentation on GitHub (see box)