Comparison Tool
An interactive web app for comparing Calculon vs Valhalla routing side by side.
Quick start
./tools/compare/run.sh
This starts three services:
| Service | Port | Description |
|---|---|---|
| Calculon | 8002 | Built and started from source |
| Valhalla | 8003 | Docker container (ghcr.io/valhalla/valhalla:latest) |
| Webapp | 9091 | Lit + MapLibre comparison UI |
Open http://localhost:9091 to start comparing.
Options
# Use Monaco tiles (smaller, ~32 km²)
./tools/compare/run.sh --tiles monaco
# Use France tiles (default)
./tools/compare/run.sh --tiles france
# Debug build (faster compilation, slower runtime)
./tools/compare/run.sh --debug
# Release build (default)
./tools/compare/run.sh --release
Tiles must exist at test_data/{name}_tiles/. Press Ctrl+C to stop all services.
Features
Route comparison
Click two points on the map to compute routes on both Calculon and Valhalla. The panel shows:
- Distance and time for each engine
- Percentage difference between the two
- Turn-by-turn maneuver list
Both routes are drawn on the map with distinct colors.
Alternate routes
The Alts control in the toolbar asks each engine for up to three alternates alongside the best route. When one comes back, the panel grows a row of tabs - Best, Alt 1, Alt 2 - showing each route's time and distance; picking a tab swaps the maneuver list and the line drawn on the map. The routes not on show are drawn dashed and dimmed in the same colour, and clicking one on the map selects it.
Each engine is asked independently, so Calculon may offer alternates where Valhalla offers none, or the other way round. Tabs only appear when there is more than one route to choose from.
Matrix comparison
Switch to Matrix mode to compare many-to-many distance/time matrices. Each cell shows the difference between engines.
Verbose mode
Enable verbose mode to see per-edge cost breakdowns. Useful for diagnosing why Calculon picks a different path than Valhalla.
Graph inspection
Right-click a location to inspect the graph — shows all edges radiating from the nearest junction with their attributes.
URL state
Route coordinates, costing mode, the number of alternates, and other settings are persisted in the URL. Share a link to reproduce a specific comparison.
Tech stack
| Layer | Technology |
|---|---|
| Components | Lit (web components) |
| Map | MapLibre GL |
| Build | Vite |
| Package manager | bun |
| Linting | Biome |
Development
cd tools/compare
bun install
bun run dev