This release is a pre-release and may not be stable for production use.
Osmium for Python
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.
Osmium library (https://github.com/joto/osmium)
Boost (http://www.boost.org)
Expat (http://expat.sourceforge.net)
Google Protocol buffers (http://code.google.com/p/protobuf/)
xml2 (http://xmlsoft.org/)
zlib (http://www.zlib.net)
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| osmium-0.1a1-r10-79b0.tar.gz | 213.4 kB | Without provenance | Details for osmium-0.1a1-r10-79b0.tar.gz |
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 |
Security for osmium 0.1a1-r10-79b0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.