skillfed

osmium

Python bindings for libosmium, the data processing library for OSM data

osmium v4.3.1 312.3K downloads/30d#7,726 on PyPI391
Permissive license BSD-2-Clause Active released

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 osmium

uv

uv add osmium

poetry

poetry add osmium

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: C++Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Free Threading :: 2 - BetaProgramming Language :: Python :: Implementation :: CPythonTopic :: Scientific/Engineering :: GISTyping :: Typed

Tags

openstreetmap data processing pythonosm file parsing librarylibosmium python bindingsgeographic data extraction toolsosm pbf parsingmap data analysis pythonopenstreetmap bulk processing
geospatialopenstreetmapdata-processing

More GIS packages