Skip to content
LocusQ

Geocoder

What it is

A Pelias fork that runs as one Docker Compose stack for any country, switched by COUNTRY_CODE, with API keys required and only the API published.

fetch stages the OSM extract, Who's On First and GeoNames, prepare builds the Placeholder store, street polylines and interpolation data, import loads Elasticsearch and up starts the serving stack.

Each import writes a new pelias_<runid> index and then moves the pelias alias, so a running stack serves the new data at once. Backups are Elasticsearch snapshots. Inputs can also come from DataGen output.

Every geocoding route needs a bearer key, compared as a SHA-256 digest. Elasticsearch, Placeholder, pip, libpostal and interpolation sit on an internal network with no host ports and no egress.

Install

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

Set the cache directory and country

Any country with a config/countries/<CC>.env works the same way. You need Docker with compose and buildx, plus bash, jq, flock, openssl, sha256sum and md5sum.

bash
export GEOCODER_CACHE_DIR=/srv/cache/locusq-geocoder   # outside the repo
export COUNTRY_CODE=LU

Build, load and start

bash
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

Minimal usage

Query it with the key from the secrets file, keeping the key out of argv:

bash
curl -sS -H @<(printf 'Authorization: Bearer %s\n' "$(head -n1 .secrets/api_keys)") \
  'http://127.0.0.1:4000/v1/search?text=Esch-sur-Alzette&size=1'

Product page: Geocoder. Release notes: Changelog.