Skip to content
LocusQ

Run LocusQ on your own servers

The services ship as Docker images or Compose stacks; GL JS installs from GitHub Packages. Everything is private for now, so the first step is asking for access.

01Install

In pipeline order

Start from your own PostGIS data, or skip to TileGen and Router with any OSM PBF, such as a Geofabrik extract.

  1. Request access

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

  2. Create the LocusQ schema (Schema)

    Apply the canonical schema to a PostGIS database. More in the Schema guide.

    bash
    DSN="postgresql://user:pass@127.0.0.1:5432/yourdb?sslmode=disable"
    scripts/apply.sh "$DSN"
    scripts/verify_v2.sh "$DSN"
  3. Load your data (DataLab)

    Map your PostGIS tables into the schema with a YAML mapping file. More in the DataLab guide.

    bash
    npm ci                                    # installs the workspaces, including tsx
    export LOCUSQ_VOCABULARY=/path/to/locusq-schema/vocabulary.yaml
    export LOCUSQ_SOURCE_DSN="postgresql://user:pass@127.0.0.1:5432/yourdb?sslmode=disable"
    npx tsx bin/locusq-convert.ts mappings/<your-mapping>.yaml
  4. Write an OSM PBF (pg2osm)

    Convert the schema database into the PBF that TileGen and Router read. More in the pg2osm guide.

    bash
    docker build -t locusq-pg2osm:0.3.0 .
    mkdir -p out && chmod a+rwx out          # the image user (uid 10001) writes here
    cp config/database.yaml out/             # your DB config (see database.yaml.example)
    docker run --rm --network host \
      -v "$PWD/out:/out" \
      -v /path/to/locusq-schema/vocabulary.yaml:/vocabulary/vocabulary.yaml:ro \
      locusq-pg2osm:0.3.0 convert --config config/master_mapping.yaml \
      --db-config /out/database.yaml --output /out/country.osm.pbf
  5. Generate geocoder data (DataGen)

    Write Who's On First, GeoNames and Placeholder data from your places. More in the DataGen guide.

    bash
    docker build -t locusq-datagen .
    export LOCUSQ_DB_URL="postgresql://user:pass@localhost:5432/dbname"
    docker run --rm --network host -e LOCUSQ_DB_URL \
      -v "$PWD/output:/work/output" \
      locusq-datagen generate --source <source> --output /work/output --all
  6. Build tiles (TileGen)

    Build PMTiles from the PBF, or from a Geofabrik area. More in the TileGen guide.

    bash
    docker build --ssh default --target runtime -t locusq-tilegen:local .
    bin/locusq-tilegen basemap --area <geofabrik-name>
  7. Serve tiles (Tilex)

    Build the image and create a key. Mount tilesets at /data/tiles; the public port is 6543. More in the Tilex guide.

    bash
    bash scripts/docker-test.sh image    # runtime image checks
    export LOCUSQ_TILEX_ADMIN_KEYS="$(openssl rand -hex 24)"
  8. Style the map (MapLab)

    Run Map Studio, FontGen and IconGen, and publish styles to Tilex. More in the MapLab guide.

    bash
    docker build --target run --build-arg GIT_REVISION=$(git rev-parse HEAD) --build-arg VERSION=0.5.0 -t locusq-maplab:local .
    MAPLAB_ADMIN_TOKEN="$(openssl rand -hex 32)" docker compose up -d
  9. Draw the map (GL JS)

    Point the @locusq scope at https://npm.pkg.github.com in .npmrc, then install the renderer. More in the GL JS guide.

    bash
    npm install @locusq/gl          # open build: MapLibre-compatible renderer with the LocusQ 3D additions
    npm install @locusq/gl-secure   # the same, plus the sealed-tile (lqp1) decoder and enableLocusQSecure()
  10. Add routing (Router)

    Build graphs, then start the gateway and the engines you need. More in the Router guide.

    bash
    export ROUTER_CACHE_DIR=$HOME/.cache/locusq
    make graphs COUNTRY=<name>
    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
  11. Add search (Geocoder)

    Build the images, load a country and start the stack. More in the Geocoder guide.

    bash
    export GEOCODER_CACHE_DIR=/srv/cache/locusq-geocoder   # outside the repo
    export COUNTRY_CODE=LU
    bash scripts/docker-test.sh images        # libpostal data into the cache, then all 14 images
    ./locusq-geocoder secrets init            # ES passwords + one API key in ./.secrets (0600)
    ./locusq-geocoder fetch LU                # stage the PBF, WOF and GeoNames into ./data
    ./locusq-geocoder prepare                 # Placeholder store, street polylines, interpolation DBs
    ./locusq-geocoder import                  # import into pelias_<runid>, then swap the alias
    ./locusq-geocoder up                      # serving stack; only the API is published
    ./locusq-geocoder status
  12. Edit transit feeds (TransitLab)

    Run the GTFS editor. Its exports are GTFS profiles for OpenTripPlanner, Valhalla and GraphHopper. More in the TransitLab guide.

    bash
    docker build --target run --build-arg GIT_REVISION=$(git rev-parse HEAD) --build-arg VERSION=0.1.0 -t locusq-transitlab:0.1.0 .
    export TRANSITLAB_ADMIN_TOKEN="$(openssl rand -base64 33)"   # 32+ characters of A-Z a-z 0-9 - . _ ~ + / (optional trailing =)
    TRANSITLAB_TAG=0.1.0 docker compose up -d

Stuck on a step? Ask us.

Tell us which tool and what you ran. The docs have a guide per tool.