Skip to main content

High-level bindings to the Valhalla C++ library

Project description

 ██▒   █▓ ▄▄▄       ██▓     ██░ ██  ▄▄▄       ██▓     ██▓    ▄▄▄
▓██░   █▒▒████▄    ▓██▒    ▓██░ ██▒▒████▄    ▓██▒    ▓██▒   ▒████▄
 ▓██  █▒░▒██  ▀█▄  ▒██░    ▒██▀▀██░▒██  ▀█▄  ▒██░    ▒██░   ▒██  ▀█▄
  ▒██ █░░░██▄▄▄▄██ ▒██░    ░▓█ ░██ ░██▄▄▄▄██ ▒██░    ▒██░   ░██▄▄▄▄██
   ▒▀█░   ▓█   ▓██▒░██████▒░▓█▒░██▓ ▓█   ▓██▒░██████▒░██████▒▓█   ▓██▒
   ░ ▐░   ▒▒   ▓▒█░░ ▒░▓  ░ ▒ ░░▒░▒ ▒▒   ▓▒█░░ ▒░▓  ░░ ▒░▓  ░▒▒   ▓▒█░
   ░ ░░    ▒   ▒▒ ░░ ░ ▒  ░ ▒ ░▒░ ░  ▒   ▒▒ ░░ ░ ▒  ░░ ░ ▒  ░ ▒   ▒▒ ░
     ░░    ░   ▒     ░ ░    ░  ░░ ░  ░   ▒     ░ ░     ░ ░    ░   ▒
      ░        ░  ░    ░  ░ ░  ░  ░      ░  ░    ░  ░    ░  ░     ░  ░
     ░

Valhalla is an open source routing engine and accompanying libraries for use with OpenStreetMap data. Valhalla also includes tools like time+distance matrix computation, isochrones, elevation sampling, map matching and tour optimization (Travelling Salesman).

Build Status

Linux macOS & Windows Code Coverage Timezone DB
Build Linux Windows & macOS CI codecov timezone_db

License

Valhalla, and all of the projects under the Valhalla organization, use the MIT License. Avatar/logo by Jordan.

OpenStreetMap data in the ./test/data is licensed under ODbL and copyrighted by OSM contributors. Additional information on licenses and other requirements concerning the data sources most frequently used by Valhalla can be found in the docs.

Overview

There are several key features that we hope can differentiate the Valhalla project from other routing and network analysis engines. They are:

  • Open source software, on open source data with a very liberal license. Should allow for transparency in development, encourage contribution and community input, and foster use in other projects.
  • Tiled hierarchical data structure. Should allow users to have a small memory footprint on memory constrained devices, enable offline routing, provide a means for regional extracts and partial updates.
  • Dynamic, runtime costing of edges and vertices within the graph via a plugin architecture. Should allow for customization and alternate route generation.
  • C++ based API. Should allow for cross compilation of the various pieces to enable routing on offline portable devices.
  • A plugin based narrative and manoeuvre generation architecture. Should allow for generation that is customized either to the administrative area or to the target locale.
  • Multi-modal and time-based routes. Should allow for mixing auto, pedestrian, bike and public transportation in the same route or setting a time by which one must arrive at a location.

Demo Server

FOSSGIS e.V. hosts a demo server which is open to the public and includes a full planet graph with an open-source web app on https://valhalla.openstreetmap.de. The HTTP API is accessible on a slightly different subdomain, e.g. https://valhalla1.openstreetmap.de/isochrone. Usage of the demo server follows the usual fair-usage policy as OSRM & Nominatim demo servers (somewhat enforced by rate limits).

Platform Compatibility

Valhalla is fully functional on many Linux and Mac OS distributions, and is also used on iOS and Android devices.

For Windows, not all functionality is fully supported yet. Building the Valhalla library works flawlessly, as well as the following application modules:

  • TOOLS: utilities to query and benchmark various components
  • DATA_TOOLS: utilities to build input data and handle transit
  • PYTHON_BINDINGS: use all actions (route, isochrones, matrix etc) via the Valhalla Python library (needs a full (i.e. development) Python distribution in the PATH)

Organization

The Valhalla organization is comprised of several library modules each responsible for a different function. The layout of the various modules is as follows:

  • Midgard - Basic geographic and geometric algorithms for use in the various other projects.
  • Baldr - The base data structures for accessing and caching tiled route data.
  • Sif - Library used in costing of graph nodes and edges. This can be used as input to loki and thor.
  • Skadi - Library and service for accessing elevation data. This can be used as input to mjolnir or as a standalone service.
  • Mjolnir - Tools for turning open data into Valhalla graph tiles.
  • Loki - Library used to search graph tiles and correlate input locations to an entity within a tile. This correlated entity (edge or vertex) can be used as input to thor.
  • Meili - Library used to for map-matching.
  • Thor - Library used to generate a path through the graph tile hierarchy. This path and attribution along the path can be used as input to odin.
  • Odin - Library used to generate manoeuvres and narrative based on a path. This set of directions information can be used as input to tyr.
  • Tyr - Service used to handle http requests for a route communicating with all of the other valhalla APIs. The service will format output from odin and support json (and eventually protocol buffer) output.
  • Tools - A set command line tools that exercise bits of functionality from the library components above and provide the basis for quality testing and performance benchmarking.
  • Demos - A set of demos which allows interacting with the service and APIs.

Documentation

Documentation is stored in the docs/ folder in this GitHub repository. It can be viewed at valhalla.github.io/valhalla.

Installation

For more information on binaries, see Command Line Tools section below and the docs.

From source

If you want to build Valhalla from source, follow the documentation.

With docker

Test & Publish Docker image

To run Valhalla locally or your own server, we recommend using one of our Docker images, see the README.

Via Python bindings

pyvalhalla version

We publish our (very) high-level Python bindings to PyPI with pyvalhalla.

The Python packages don't only contain the Python bindings, they also provide access to the C++ executables, e.g. in the form of python -m valhalla valhalla_build_tiles -h. For more details, see the Python README.

To install the native C++ executables one doesn't even need to have root permissions or even have Python installed. Simply download the desired wheel from PyPI, extract it with e.g. unzip and run the included valhalla/bin/<binary> directly.

Via NodeJS bindings

npm version npm version

We provide high-level NodeJS binding:

npm install @valhallajs/valhallajs

For more details, see the NodeJS README.

Contributing

We :heart: contributions to Valhalla. They could be non-technical, e.g. translations into other languages via Transifex or documentation improvements, or technical ones like bug fixes or feature implementations. It's important to open an issue before setting out to work on a PR.

Ideally, get familiar with our Contribution guidelines first.

Command Line Tools

[!TIP] Easily install various Valhalla command line tools like valhalla_build_tiles or valhalla_service with the Python bindings.

valhalla_service aka one-shot mode

If you can't (e.g. Windows Server) or don't want to have the full-fledged HTTP API running, you can have the (almost) exact same behavior with the 'valhalla_service' executable in so-called "one-shot" mode. It's simple, just pass the config file, the action (route, isochrone, matrix etc) and the stringified JSON request (or alternatively a file containing the request to circumvent shell command length issues):

valhalla_service valhalla.json isochrone '{"locations":[{"lat":42.552448,"lon":1.564865}],"costing":"auto","contours":[{"time":10,"color":"ff0000"}], "show_locations":true}'
# Alternatively you can pass a file with the same contents
valhalla_service valhalla.json isochrone isochrone_request.txt

It's important to note that all Valhalla logs for one-shot mode are piped to stderr while the actual JSON response will be in stdout. To completely silence the logs, pass type: "" to midgard.logging in the config file.

Batch Script Tool

Related projects

The following projects are open-source and built with the intention to make it easier to use Valhalla and its features:

  • OpenStreetMapSpeeds: A project conflating open GPS data to improve Valhalla's speed classification. The current JSON is from early 2022 and can be downloaded here and used by setting the path in the mjolnir.default_speeds_config config option.
  • valhalla-operator: A k8s operator to deploy and manage Valhalla.
  • valhalla-app: A React based web app for Valhalla, powering https://valhalla.openstreetmap.de/.
  • valhalla-qgis-plugin: A QGIS plugin for Valhalla, also available in the official QGIS plugin store, featuring built-in valhalla_service and valhalla_build_tiles.
  • routingpy: A Python client for most open-source routing engines, including Valhalla, with a common interface for all engines. Available on PyPI.
  • routingjs: A TypeScript client for most open-source routing engines, including Valhalla, with a common interface for all engines. Available as engine-specific packages on npm.
  • Valhalla_jll.jl: Valhalla binaries shipped for Julia.
  • valhalla-go: Valhalla Golang bindings via cgo

Project details


Download files

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

Source Distribution

pyvalhalla-3.6.3.tar.gz (35.7 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyvalhalla-3.6.3-cp312-abi3-win_amd64.whl (24.2 MB view details)

Uploaded CPython 3.12+Windows x86-64

pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_x86_64.whl (35.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_aarch64.whl (32.6 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

pyvalhalla-3.6.3-cp312-abi3-macosx_14_0_arm64.whl (23.6 MB view details)

Uploaded CPython 3.12+macOS 14.0+ ARM64

File details

Details for the file pyvalhalla-3.6.3.tar.gz.

File metadata

  • Download URL: pyvalhalla-3.6.3.tar.gz
  • Upload date:
  • Size: 35.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvalhalla-3.6.3.tar.gz
Algorithm Hash digest
SHA256 daee61451072739414026ce4b6b642fc534dea7bbc792eb68a9dd0c3a5d78604
MD5 2684faa29bde0e72bf51cb47d243af41
BLAKE2b-256 0467f1fb5cb3df1fa19555acde4a99e8a7c97333fc2aa8e4077fdb191ddb0b60

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvalhalla-3.6.3.tar.gz:

Publisher: osx_win_python_builds.yml on valhalla/valhalla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvalhalla-3.6.3-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: pyvalhalla-3.6.3-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 24.2 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyvalhalla-3.6.3-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 346683e30db8b33851721876e4c9b3e009f035b652e17b72c91c52b55d4eea36
MD5 a8b9dcfab97aded2da2a6b4bb4f82007
BLAKE2b-256 dffa3f32f54e1c34207d47338c73d5982fcc1070e027c51f0430fdfb33f83060

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvalhalla-3.6.3-cp312-abi3-win_amd64.whl:

Publisher: osx_win_python_builds.yml on valhalla/valhalla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e123720983ce570f340c3ef78289098bf647deba68d56143571384a5aa874868
MD5 d74e561df10c15d6d9f05ee7e965c1af
BLAKE2b-256 d3cc78891758cd34dfdc9c8924a92cb1a9f48d594acc03d2b62d68d9933abaaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: osx_win_python_builds.yml on valhalla/valhalla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b3e60b2b474c9e27e3303b964d54603a249ca952ae5100e3a8d361107d1c329d
MD5 a5a3df3735915a91452dc27e6f10597d
BLAKE2b-256 59d2c10fe5cdab114153c8270d45d6a1468efc548062183ed16750d2357c871d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvalhalla-3.6.3-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: osx_win_python_builds.yml on valhalla/valhalla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyvalhalla-3.6.3-cp312-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for pyvalhalla-3.6.3-cp312-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 ebc46f6d53ed616b89a88c49787e478b941cd7cf2ccbeab0a1d25f1341cf4211
MD5 6e27df2c457a20db13a3c97bb1dae5f4
BLAKE2b-256 cf167b6f2c3e79a95613b950c0b2d9643278fa77b20b6ea0ff4710e9309d3d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyvalhalla-3.6.3-cp312-abi3-macosx_14_0_arm64.whl:

Publisher: osx_win_python_builds.yml on valhalla/valhalla

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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