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
| Flag | Default | What |
|---|---|---|
--database-url | DATABASE_URL | Postgres connection string |
--table | geocoding | Table with the geocoding columns |
--out | (required) | Output file |
--importance-weight | 10.0 | Weight of importance in the rank |
--run-mib | 8192 | Memory for the posting lists of one run, in MiB; past it they go to disk and are merged at the end |
--spool | Cut the sections into part files under this directory for an uploader instead of writing one file | |
--key | planet | Object key prefix in the spool manifest |
--part-mib | 90 | Part size in MiB |
--parts-per-object | 9000 | Parts per object (R2 allows 10,000) |
--max-pending | 24 | Parts 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
| Flag | Default | What |
|---|---|---|
--file | (required) | The .glx file |
--size | 10 | Hits per query |
--max-waves | Read waves before answering with what is verified | |
--record-wave | 512 | Record blocks the first record wave asks for |
--blocks | Count the distinct 64 KiB blocks each query touches | |
--text | Run 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.