Guide

OSRM vs Valhalla vs GraphHopper: choosing a routing engine in 2025

Technical comparison of open-source routing engines — OSRM, Valhalla, and GraphHopper. Architecture, performance, features, and deployment complexity.

OSRM vs Valhalla vs GraphHopper: Choosing a routing engine in 2025

Selecting the right routing engine can significantly impact your application's performance, scalability, and routing accuracy. With various open-source options available, developers often find themselves comparing OSRM, Valhalla, and GraphHopper to understand their benefits and trade-offs. Each routing engine employs different algorithms and data structures, leading to varied implementations, use cases, and deployment complexities. This decision carries weight, especially as the demand for efficient, customizable routing solutions escalates in a world increasingly reliant on navigation technology.

Overview of routing engines

Before diving into specific routing engines, it's essential to consider the general concepts and methodologies used in routing. The main approaches include:

  • Dijkstra's algorithm: Guarantees the shortest path on weighted graphs. It's straightforward but can be computationally intensive for larger datasets.
  • A algorithm*: An enhancement of Dijkstra's that uses heuristics to prioritize node exploration, often resulting in faster pathfinding.
  • Contraction hierarchies: A speed-up technique that preprocesses the graph, creating shortcuts and resulting in faster query responses once the data is fully indexed.

OSRM

Architecture and Routing Logic

Open Source Routing Machine (OSRM) is a high-performance routing engine that excels in speed. It utilizes a contraction hierarchy to preprocess OSM data, allowing it to quickly return results for simpler queries. OSRM primarily focuses on car routing and is highly optimized for daily use.

Deployment and Scalability

OSRM is designed for Docker deployment, making it accessible for developers familiar with containerization. The default installation process is straightforward, resulting in a low maintenance burden.

Use Cases

OSRM is particularly effective for applications that require fast routing for road networks, providing turn-by-turn navigation at scale. However, its flexibility for other transportation methods, such as pedestrian or cycling, is somewhat limited compared to its counterparts.

docker run -t -d -p 5000:5000 osrm/osrm-backend osrm-routed --algorithm mld /data/your-map.osrm

Valhalla

Architecture and Routing Logic

Valhalla is a robust routing engine designed for multimodal routing, catering to a variety of transport modes, including walking, cycling, driving, and transit. Its architecture is built around flexibility, allowing for customizable routing logic via its various routing profiles, including the ability to integrate additional data sets.

Deployment and Features

Valhalla can also be deployed via Docker, and it provides rich features such as turn-by-turn navigation, real-time updates, and isochrone generation. The latter is particularly useful for visualizing potential travel areas from a given point in a set timeframe.

Use Cases

With its versatility, Valhalla excels in applications requiring complex routing demands, such as urban planning tools or logistics management. This flexibility often comes at a cost of increased installation complexity, as setting up Valhalla can be more demanding than OSRM.

docker run -d -p 8002:8002 -p 8003:8003 -v /path/to/pbf:/data ghcr.io/valhalla/valhalla:latest valhalla_build_tiles -c /path/to/valhalla.json /data/osm.pbf

GraphHopper

Architecture and Routing Logic

GraphHopper provides both a routing engine and a mapping library, emphasizing ease of use and integration. It utilizes a modified version of Dijkstra’s algorithm combined with contraction hierarchies to deliver fast results, particularly for bicycle and pedestrian routes.

Deployment and Customization

GraphHopper supports various deployment methods, including standalone, Docker, and even as a service in the cloud. Its straightforward API allows developers to customize routing profiles with relative ease.

Use Cases

GraphHopper’s focus on diverse transportation methods makes it suitable for applications requiring tailored routing solutions, such as tourist navigators or package delivery services where bicycle and pedestrian routing is essential.

docker run -it --rm -p 8989:8989 graphhopper/graphhopper:latest road /data/your-map.osm.pbf

Summary comparison table

Feature OSRM Valhalla GraphHopper
Routing Algorithm Contraction hierarchies A* with multimodal support Dijkstra with contraction hier.
Turn-by-Turn Navigation Yes Yes Yes
Isochrone Capabilities No Yes Limited
Truck Routing Limited Yes Yes (with custom profiles)
Deployment Docker Docker Docker / Standalone / Cloud
Licensing MIT MIT Apache 2.0

Further options

Beyond these engines, other hosted alternatives like Mapsi offer various geospatial services that can simplify the implementation process for routing needs.

Closing thoughts

Choosing the right routing engine heavily depends on the specific needs of your application, such as transport mode requirements, deployment environment, and routing complexity. Developers should evaluate these factors thoroughly when making their selection. Future scalability and maintenance ease should also guide your choice, ensuring that the routing solution remains a valuable asset as your project evolves.

FAQ block

See also

Start building with Mapsi — free

No credit card required. Free tier includes 10,000 requests/month.

Try it now
curl "https://api.mapsi.dev/geocode?q=Berlin&key=YOUR_KEY"
  • EU-hosted on Hetzner — GDPR compliant
  • Open-source core — Pelias + Valhalla
  • Store results forever — no lock-in