Skip to main content

High-level bindings to the Valhalla C++ library

Project description

Valhalla for Python

Master Push

This spin-off project simply offers packaged Python bindings to the fantastic Valhalla project.

Over time we will very likely deviate from Valhalla's own Python binding code to allow usages outside the scope of the core project. Refer to our release pattern to learn more about the versioning of this project.

Note, the performance boost using these bindings compared to requesting an HTTP service is tremendous: on 500 random routes in Berlin, the bindings take 27 secs while HTTP on localhost takes 127 secs.


pypi version

We distribute all currently maintained CPython versions as binary wheels for Win64, MacOS (Intel) and x86_64 Linux distributions with glibc>=2.28. We do not offer a source distribution on PyPI. Please contact us on if you need support building the bindings for your platform/distribution.

pip install pyvalhalla

Note, to install from PyPI as a Linux user you must have pip version 20.3 or greater installed.


Find a more extended notebook in ./examples, e.g. how to use the actor.

Before using the Python bindings you need to have access to a routable Valhalla graph. Either install Valhalla from source and built the graph from OSM compatible data or use our Valhalla docker image for a painless experience, e.g. this will build the routing graph for Andorra in ./custom_files:

docker run --rm --name valhalla_gis-ops -p 8002:8002 -v $PWD/custom_files:/custom_files -e tile_urls= gisops/valhalla:latest

Once you have created a graph locally, you can use it like this:

from valhalla import Actor, get_config, get_help

# generate configuration
config = get_config(tile_extract='./custom_files/valhalla_tiles.tar', verbose=True)

# print the help for specific config items (has the same structure as the output of get_config()

# instantiate Actor to load graph and call actions
actor = Actor(config)
route = actor.route({"locations": [...]})


pyvalhalla is licensed with GPLv2, see LICENSE.

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

pyvalhalla-3.2.0-cp311-cp311-win_amd64.whl (2.7 MB view hashes)

Uploaded cp311

pyvalhalla-3.2.0-cp310-cp310-win_amd64.whl (2.7 MB view hashes)

Uploaded cp310

pyvalhalla-3.2.0-cp39-cp39-win_amd64.whl (2.7 MB view hashes)

Uploaded cp39

pyvalhalla-3.2.0-cp38-cp38-win_amd64.whl (2.7 MB view hashes)

Uploaded cp38

pyvalhalla-3.2.0-cp37-cp37m-win_amd64.whl (2.7 MB view hashes)

Uploaded cp37

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