Calculon
Calculon is a high-performance, Valhalla-compatible routing engine written in Rust. It provides turn-by-turn navigation using bidirectional A* pathfinding on hierarchical graph tiles.
It reads binary Valhalla-format graph tiles and exposes an HTTP API compatible with Valhalla's JSON format — making it a drop-in replacement for routing workloads.
Features
Fast
Bidirectional A* search with pre-computed lookup tables for O(1) speed factors and turn costs. CPU-bound work runs in spawn_blocking tasks while the Axum server stays async.
Turn-by-turn navigation
Full maneuver building with localized narrative instructions in 36+ languages.
Distance/time matrices
Many-to-many distance and time computation via CostMatrix with hierarchical graph expansion and shortcut edges.
Valhalla-compatible
Same tile format, same JSON API. Point your existing Valhalla tiles at Calculon and go.
Multiple travel modes
Driving (auto), cycling (bicycle), and walking (pedestrian) cost models with rich tuning options.
Quick start
# Build
cargo build -p calculon --release
# Run
./target/release/calculon --tile-dir /path/to/valhalla/tiles
# Route request
curl -s http://localhost:8002/route -d '{
"locations": [
{"lat": 48.8566, "lon": 2.3522},
{"lat": 48.8606, "lon": 2.3376}
],
"costing": "auto"
}' | jq '.trip.summary'
Endpoints
| Endpoint | Description |
|---|---|
POST /route |
Turn-by-turn routing |
POST /sources_to_targets |
Many-to-many distance/time matrix |
POST /debug/inspect |
Inspect graph connectivity at a junction |
POST /debug/cost |
Cost breakdown for edges at a junction |
GET /status |
Server health check |
Next steps
- Getting started — build, install, run
- Configuration — CLI args, config file, costing defaults
- Architecture — crate hierarchy, design patterns
- Tile format — binary tile layout, caching, spatial binning
- Narrative & i18n — 34 languages, maneuver types
- Comparison tool — side-by-side Calculon vs Valhalla