Skip to content

Getting Started


Prerequisites

  • Rust (nightly toolchain)
  • Valhalla tiles — Calculon reads standard Valhalla binary graph tiles

Build

# Clone the repository
git clone https://github.com/manz/calculon.git
cd calculon

# Build the workspace (debug)
cargo build --workspace

# Build release binary
cargo build -p calculon --release

The release binary is at target/release/calculon.


Run

# Minimal — just point at your tiles
calculon --tile-dir /path/to/valhalla/tiles

# Custom bind address and cache size
calculon --tile-dir /data/tiles --bind 127.0.0.1:9000 --cache-size 500

# With a config file
calculon --config /etc/calculon.toml

By default, Calculon binds to 0.0.0.0:8002 with a tile cache of 200 entries.


Verify

# Health check
curl http://localhost:8002/status | jq

# Compute a route
curl -s http://localhost:8002/route -d '{
  "locations": [
    {"lat": 43.7396, "lon": 7.4289},
    {"lat": 43.7274, "lon": 7.4183}
  ],
  "costing": "auto"
}' | jq '.trip.summary'

Run tests

# All tests (uses Monaco tiles committed in test_data/)
cargo test --workspace

# Single crate
cargo test -p calculon-route

# Single test
cargo test --workspace -- test_name

# Lint
cargo clippy --workspace --all-targets -- -D warnings

# Format
cargo fmt --all

Integration tests use real Monaco graph tiles committed in test_data/monaco_tiles/. These tiles cover ~32 km² and enable fast, deterministic routing tests without external dependencies.


Benchmarks

# Run all benchmarks (requires france_tiles)
cargo bench --workspace

Benchmarks cover tile loading, costing, routing (city/regional/long), and matrix computation.