osmium
Python bindings for libosmium, the data processing library for OSM data
What it is and what it does
osmium is a Python wrapper around Libosmium, a high-performance C++ library for reading and processing OpenStreetMap data. It allows developers to parse OSM files (typically in PBF or XML format) and extract geographic features—nodes, ways, relations—with callbacks or streaming handlers. The library is designed for bulk data processing tasks where speed matters, such as extracting specific map features, analyzing road networks, or transforming raw OSM data into application-specific formats.
The package depends on requests and requires system libraries (expat, libz, libbz2) for compilation. It supports Python 3.8 through 3.14 on CPython and provides prebuilt wheels for most platforms, though compilation from source may be necessary on less common architectures. The codebase is actively maintained, with a stable API and comprehensive documentation.
Use it for:
- Extract all buildings or roads from a regional OSM dataset for mapping or urban planning applications.
- Parse and filter OSM change files to detect new or modified geographic features in near-real-time.
- Convert raw OSM data into a custom database or GIS format for downstream analysis.
- Analyze road networks or pedestrian infrastructure by traversing ways and their node relationships.
- Build tile-based map renderers or geographic search indexes from OSM source data.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
osmium provides Python bindings for the Libosmium C++ library, enabling fast and flexible processing of OpenStreetMap data.
Yes, if you need to process OpenStreetMap data at scale. osmium is the standard Python interface to Libosmium and offers the performance and flexibility required for serious OSM work. Install friction is moderate—you'll need system libraries and a C++ compiler—but prebuilt wheels handle most common environments. No known security issues, active maintenance, and a permissive license make it a solid choice. Skip it if you only need lightweight, read-only access to OSM via web APIs.
Install
osmium on PyPI
pip
pip install osmiumuv
uv add osmiumpoetry
poetry add osmiumInstalling osmium
Before you install
Medium install friction due to C++ compilation requirements. The package requires development headers for expat, libz, and libbz2 on Linux/macOS. Prebuilt wheels are available for Python 3.8–3.14 across common platforms (macOS, Linux, Windows), reducing friction for standard environments. Last release was 134 days ago; repository is active with recent commits.
License in practice
BSD-2-Clause is a permissive open-source license allowing commercial and private use with minimal restrictions. You must retain the license notice and disclaimer, but there are no copyleft obligations.
Quickstart
pip install osmium
import osmium
class MyHandler(osmium.SimpleHandler):
def node(self, n):
print(n.id, n.location.lat, n.location.lon)
handler = MyHandler()
handler.apply_file('data.osm.pbf')
Requires expat, libz, and libbz2 development headers. On Debian/Ubuntu: sudo apt-get install build-essential cmake libexpat1-dev zlib1g-dev libbz2-dev. Requires Python >= 3.8; PyPy is not supported.
Verify before relying
- Specific performance characteristics or throughput limits for large OSM datasets.
- Whether requests dependency is used internally or only as a transitive requirement.
- Compatibility with alternative OSM processing libraries and typical data pipeline patterns.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | actively maintained — 134 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 312,287/month — #7,726 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: osmium-4.3.1-cp310-cp310-macosx_11_0_arm64.whl; osmium-4.3.1-cp310-cp310-macosx_11_0_x86_64.whl; osmium-4.3.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; osmium-4.3.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; osmium-4.3.1-cp310-cp310-win_amd64.whl; osmium-4.3.1-cp310-cp310-win_arm64.whl; osmium-4.3.1-cp311-cp311-macosx_11_0_arm64.whl; osmium-4.3.1-cp311-cp311-macosx_11_0_x86_64.whl; osmium-4.3.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; osmium-4.3.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; osmium-4.3.1-cp311-cp311-win_amd64.whl; osmium-4.3.1-cp311-cp311-win_arm64.whl; osmium-4.3.1-cp312-cp312-macosx_11_0_arm64.whl; osmium-4.3.1-cp312-cp312-macosx_11_0_x86_64.whl; osmium-4.3.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; osmium-4.3.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; osmium-4.3.1-cp312-cp312-win_amd64.whl; osmium-4.3.1-cp312-cp312-win_arm64.whl; osmium-4.3.1-cp313-cp313-macosx_11_0_arm64.whl; osmium-4.3.1-cp313-cp313-macosx_11_0_x86_64.whl
Keywords: OSM, OpenStreetMap, Osmium
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
osmnxOSMnx downloads, models, and analyzes street…
permissive · top 15,000 on PyPI
overpyA Python wrapper for querying the Overpass API…
permissive · top 15,000 on PyPI
osm2geojsonConverts OpenStreetMap and Overpass API data…
permissive · top 15,000 on PyPI
arcgisAccess Esri's ArcGIS services and geospatial…
unclear · top 15,000 on PyPI
GeoAlchemy2GeoAlchemy2 extends SQLAlchemy to work with…
permissive · top 5,000 on PyPI
contextilyContextily retrieves tile-based map imagery…
permissive · top 15,000 on PyPI
cityseerComputes network centrality, land-use…
agpl · top 15,000 on PyPI
pylibfdtProvides Python bindings to libfdt, the device…
unclear · top 15,000 on PyPI
staticmapGenerates static map images with geographic…
unclear · top 15,000 on PyPI