Skip to content

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.

Avoiding actions

Avoid actions routes around the blockades and gatherings announced on 17octobregiletjaune.net, read live through the dev server's /actions-feed proxy (the site allows no other origin). Only actions that stop or slow traffic count: blockades, filtering checkpoints, go-slows, roundabouts, demonstrations, gatherings, picket lines.

It is time-aware. Set Depart, and Last: how long an action is assumed to go on after its announced start (they only publish a start; 4 h by default, from 30 minutes before). The tool routes, works out when the route passes each action within 150 m, closes those under way at that moment with a 120 m exclude_polygons octagon, and routes again until the route meets none (five passes at most). Exclusions only accumulate, so a later pass never brings back a closed place.

  • The map shows every disruptive action of the day: small orange dots, and big red ones for those this route was closed around (click for details).
  • The panel lists what was avoided, and anything still in the way.
  • Valhalla, when compared, gets the same closures.
  • In Matrix mode there is no single route to time: every action under way at some point between departure and departure + Last is closed.

The settings are kept in the URL (avoid=actions, depart=, last=).

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