.glx docs

Command line

glx-build writes a .glx file from a Postgres geocoding table; glx-query runs queries against a local .glx file and reports hits, read waves and bytes read; glx-parts lists and merges the parts of .glx files.

By · Updated

The geolith-glx crate has three command-line tools. glx-build and glx-query are behind its build feature; glx-parts needs no feature. Build them from a checkout of the glx repository:

cargo build --release --features build --bin glx-build --bin glx-query
cargo build --release --bin glx-parts

To build a .glx straight from Overture Maps and OpenStreetMap, use the geolith builder instead; it uses the same writer.

glx-build

Writes a .glx file from a Postgres table with the geocoding columns (the table geolith's pg-copy output loads).

DATABASE_URL=postgres://localhost/geo glx-build --table geo_fr --out france.glx
FlagDefaultWhat
--database-urlDATABASE_URLPostgres connection string
--tablegeocodingTable with the geocoding columns
--out(required)Output file
--importance-weight10.0Weight of importance in the rank
--run-mib8192Memory for the posting lists of one run, in MiB; past it they go to disk and are merged at the end
--spoolCut the sections into part files under this directory for an uploader instead of writing one file
--keyplanetObject key prefix in the spool manifest
--part-mib90Part size in MiB
--parts-per-object9000Parts per object (R2 allows 10,000)
--max-pending24Parts waiting for the uploader, per section, before the build waits

glx-query

Runs queries against a local file. It reads JSON lines on stdin and writes one JSON line per query with the hit ids, ranks, points ([lat, lon]), read waves, range reads, bytes read, CPU time and wall time.

echo '{"text": "Baner, Pune", "autocomplete": false}' | glx-query --file india.glx --text
FlagDefaultWhat
--file(required)The .glx file
--size10Hits per query
--max-wavesRead waves before answering with what is verified
--record-wave512Record blocks the first record wave asks for
--blocksCount the distinct 64 KiB blocks each query touches
--textRun the full text search the servers and the wasm reader use (town anchors, rings, kinds of place) instead of the plain ranked search

With GLX_TRACE set, stderr also carries a trace of every byte range read, for simulating fetch costs.

glx-parts

Lists and merges the parts of .glx files.

glx-parts info planet.glx
glx-parts merge planet.glx search.glx routing.glx
  • info <file> prints each part's kind, offset, length and checksum, and whether its bytes match the checksum. It exits with status 1 when a part fails its checksum.
  • merge <out> <in>... copies the parts of the input files into one file, the search part first and the rest in input order. It checks each part's checksum before it writes and again as it copies, and refuses two inputs that hold a part of the same kind.