Skip to main content

Python bindings for libosmium, the data processing library for OSM data, with numpy interface

Project description

# npyosmium

Fork of [pyosmium](https://github.com/osmcode/pyosmium), including (only one for the time being) efficient numpy interface.

# pyosmium

Provides Python bindings for the [Libosmium](https://github.com/osmcode/libosmium) C++ library, a library for working with OpenStreetMap data in a fast and flexible manner.

[![Github Actions Build Status](https://github.com/agrenott/npyosmium/workflows/CI/badge.svg)](https://github.com/agrenott/nyosmium/actions?query=workflow%3ACI) [![PyPI version](https://badge.fury.io/py/npyosmium.svg)](https://badge.fury.io/py/npyosmium)

## Installation

npyosmium works with Python >= 3.8. Pypy is known to not work.

### Using Pip

The recommended way to install npyosmium is via pip:

pip install npyosmium

We provide binary wheels for Linux and Windows 64 for all actively maintained Python versions.

For other versions, a source wheel is provided. Make sure to install all external dependencies first. On Debian/Ubuntu-like systems, the following command installs all required packages:

sudo apt-get install build-essential cmake libboost-dev

libexpat1-dev zlib1g-dev libbz2-dev

### Installing from source

#### Prerequisites

npyosmium has the following dependencies:

### Compiling from Source

Get the latest versions of libosmium, protozero and pybind11 source code. It is recommended that you put them in a subdirectory contrib.

You can do this by cloning their repositories into that location.

Following commands should achieve this:

` mkdir contrib cd contrib git clone https://github.com/osmcode/libosmium.git git clone https://github.com/mapbox/protozero.git git clone https://github.com/pybind/pybind11.git `

You can also set custom locations with LIBOSMIUM_PREFIX, PROTOZERO_PREFIX and PYBIND11_PREFIX respectively.

` git clone --quiet --depth 1 https://github.com/osmcode/libosmium.git contrib/libosmium git clone --quiet --depth 1 https://github.com/mapbox/protozero.git contrib/protozero git clone --quiet https://github.com/pybind/pybind11.git contrib/pybind11 `

To use a custom boost installation, set BOOST_PREFIX.

To compile the bindings during development, you can use [build](https://pypa-build.readthedocs.io/en/stable/). On Debian/Ubuntu-like systems, install python3-build, then run:

` sudo apt install build-essential cmake libsparsehash-dev libexpat1-dev libboost-dev zlib1g-dev libbz2-dev liblz4-dev pip install build python3 -m build -w `

To compile and install the bindings, run

pip install [–user] .

## Examples

The example directory contains small examples on how to use the library. They are mostly ports of the examples in Libosmium and osmium-contrib.

## Testing

There is a small test suite in the test directory. This provides unit test for the python bindings, it is not meant to be a test suite for Libosmium.

Testing requires pytest and pytest-httpserver. On Debian/Ubuntu install the dependencies with:

sudo apt-get install python3-pytest python3-pytest-httpserver

The test suite can be run with:

pytest test

## Documentation

To build the documentation you need [Sphinx](http://sphinx-doc.org/) and the [autoprogram extension](https://pythonhosted.org/sphinxcontrib-autoprogram/) On Debian/Ubuntu install python-sphinx sphinxcontrib-autoprogram or python3-sphinx python3-sphinxcontrib.autoprogram.

First compile the bindings as described above and then run:

cd doc make html

For building the man pages for the tools run:

cd doc make man

## Bugs and Questions

If you find bugs or have feature requests, please report those in the [github issue tracker](https://github.com/agrenott/npyosmium/issues/).

For general questions about using pyosmium you can use the [OSM development mailing list](https://lists.openstreetmap.org/listinfo/dev) or ask on [OSM help](https://help.openstreetmap.org/).

## License

npyosmium is available under the BSD 2-Clause License. See LICENSE.TXT.

## Authors

Sarah Hoffmann (lonvia@denofr.de), Aurélien Grenotton (agrenott@gmail.com)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

npyosmium-3.7.0-cp312-cp312-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.12 Windows x86-64

npyosmium-3.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

npyosmium-3.7.0-cp312-cp312-macosx_11_0_arm64.whl (1.2 MB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

npyosmium-3.7.0-cp312-cp312-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

npyosmium-3.7.0-cp311-cp311-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.11 Windows x86-64

npyosmium-3.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

npyosmium-3.7.0-cp311-cp311-macosx_11_0_arm64.whl (1.2 MB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

npyosmium-3.7.0-cp311-cp311-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

npyosmium-3.7.0-cp310-cp310-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 Windows x86-64

npyosmium-3.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

npyosmium-3.7.0-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

npyosmium-3.7.0-cp310-cp310-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

npyosmium-3.7.0-cp39-cp39-win_amd64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

npyosmium-3.7.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

npyosmium-3.7.0-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

npyosmium-3.7.0-cp39-cp39-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

npyosmium-3.7.0-cp38-cp38-win_amd64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

npyosmium-3.7.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

npyosmium-3.7.0-cp38-cp38-macosx_10_9_x86_64.whl (1.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page