Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

This is a Python port of the Osmium (http://wiki.openstreetmap.org/wiki/Osmium) library, which provides a fast and flexible toolkit for working with Open Street Map data.

Currently there is only a small subset of the Osmium toolkit implemented. You can read and write OSM files in different formats and process them through a customized filter. See below for details.

Installation

Prerequisites

Osmium depends on the following C/C++ libraries. Please make sure they are installed.

If you have a Debian based distribution, you can install the required packages by:

$ sudo apt-get install libosmium-dev libboost-dev libexpat1-dev libprotobuf-dev protobuf-compiler zlib1g-dev libxml2-dev

Building

If all libraries are installed in their default location, you can install directly from PyPI using pip or setuptools by running the respective command:

$ pip install -U osmium

or:

$ easy_install -U osmium

Otherwise you can download osmium and install the library directy from source:

$ python setup.py install

In each case the installer will try to find the needed libraries and abort if something is missing.

Manual configuration

This package comes with a GNU autoconf configure script. You have to call it manually, if some libraries are in non-standard places. You can call it like:

$ sh ./configure --with-osmium=/path/to/osmium/include --with-expat=/path/to/expat

before continuing like above:

$ python setup.py install

The configure script accepts the following parameters

  • --with-osmium: include directory of Osmium installation

  • --with-expat: prefix of Expat installation

All other libraries register with pkg-config. Please make sure it is installed. If it is in some non-standard location, you have to set the environment variable PKG_CONFIG:

$ PKG_CONFIG='/my/special/pkg-config' ./configure

Basic Usage

You usually build a filtering chain by opening an osmium.OSMFile and read it through a osmium.handler.* class. To process all contents of a file through the osmium.handler.Debug handler, you can write

import osmium

infile = osmium.OSMFile(b'my_city.osm.pbf')
handler = osmium.handler.Debug()
infile.read(handler)

There are also handlers, which write the processed objects to a file. You can create such a handler via the create_output_file method:

import osmium

infile = osmium.OSMFile(b'my_city.xml.gz')
outfile = osmium.OSMFile(b'my_city.osm.pbf')

handler = outfile.create_output_file()
infile.read(handler)

This little program converts the file my_city.xml.gz (expected in XML format) to my_city.osm.pbf (which is written in PBF Format).

You can also write your own handlers. To print out all cities, use:

import osmium

class CityPrinterHandler(osmium.handler.Base):

    def node(self, node):
        if node.tags.get('place')=='city':
            print(node.tags.get('name'))

infile = osmium.OSMFile(b'my_country.osm.pbf')
handler = CityPrinterHandler()

infile.read(handler)

Metadata

Release files for osmium 0.1a1-r10-79b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for osmium 0.1a1-r10-79b0
File Size Uploaded
osmium-0.1a1-r10-79b0.tar.gz 213.4 kB Details

Release files / osmium-0.1a1-r10-79b0.tar.gz

Download URL osmium-0.1a1-r10-79b0.tar.gz
Size 213.4 kB
Tags Source
SHA-256 checksum
How to use checksums
95903972b8f5204fff4758954a0862065301d7b62727c789f118cd961591a2aa
BLAKE2b-256 checksum
How to use checksums
1c5864419f076422a5a7d11c45ba24e8a81754f86337be14a47a4bfd68c592d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

4.3.0

54 release files

4.2.0

54 release files

4.1.1

54 release files

4.1.0

54 release files

4.0.2

32 release files

4.0.1

32 release files

4.0.0

32 release files

3.7.0

26 release files

3.6.0

19 release files

3.4.1

16 release files

3.4.0

16 release files

3.3.0

17 release files

3.2.0

14 release files

3.1.2

15 release files

3.1.1

15 release files

3.1.0

24 release files

3.0.1

24 release files

2.14.1

3 release files

2.14.0

3 release files

2.13.0

3 release files

2.12.4

3 release files

2.12.3

3 release files

2.12.1

1 release file

2.12.0

1 release file

2.11.0

1 release file

2.10.2

1 release file

2.9.0

1 release file

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page