Skip to content
LocusQ

One routing API in front of four engines

Router is a Go gateway for OSRM, Valhalla, GraphHopper and OpenTripPlanner. It offers curated /v1 endpoints with a Redis cache, and relays each engine's own API byte for byte.

Navigation

0.2.0Free

01What it does

Each capability has one engine

Route and nearest go to OSRM, matrix and trip to Valhalla, match and isochrone to GraphHopper, and transit to OpenTripPlanner. The map is fixed, so an answer always comes from the same engine.

text
/v1/route, /v1/nearest      OSRM (car, bicycle, foot)
/v1/matrix, /v1/trip        Valhalla
/v1/match, /v1/isochrone    GraphHopper
/v1/transit                 OpenTripPlanner (GraphQL)

Graphs from your own extract

No country is built in. make graphs downloads an OSM extract and an optional GTFS feed, checks their checksums, builds every engine's graph in capped containers and reuses unchanged inputs.

bash
export ROUTER_CACHE_DIR=$HOME/.cache/locusq      # inputs and graphs live here
make graphs COUNTRY=<name>                       # = scripts/docker-test.sh graphs <name>

Auth on by default

The gateway refuses to start without an API key, binds 127.0.0.1, rate-limits /v1 per client IP before checking the key, and serves /metrics only on an internal port.

bash
export ROUTER_API_KEYS="$(openssl rand -hex 24)"   # comma-separated, each >= 16 chars

02Install

Run Router yourself

  1. Get access

    The repositories and packages are private while LocusQ is in private release. Ask for access and say which tools you need.

  2. Build graphs

    Needs Docker with Compose v2 and nothing else on the host. Each build step waits for enough free memory and runs in its own capped container.

    bash
    export ROUTER_CACHE_DIR=$HOME/.cache/locusq
    make graphs COUNTRY=<name>
  3. Start the gateway and engines

    Profiles are osrm, valhalla, graphhopper, otp and monitoring. Only the gateway publishes a port, 127.0.0.1:8080 by default.

    bash
    export ROUTER_API_KEYS="$(openssl rand -hex 24)"   # comma-separated, each >= 16 chars
    export ROUTER_TIMEZONE=Europe/Paris                  # the graph's IANA zone (transit date+time)
    export ROUTER_PROBE_POINT=2.35,48.85                 # lon,lat inside your OSRM graph (required with OSRM)
    export ROUTER_UID=$(id -u) ROUTER_GID=$(id -g)       # the uid that built the graphs (GraphHopper writes a lock file)
    docker compose --profile osrm --profile valhalla up -d --build
    curl -s http://127.0.0.1:8080/health

Route on your own graphs

The guide covers the engines, graph builds and the environment.