Search docs

The index file

Build the .glx file that geolith search serves.

By ยท Updated

geolith search answers every request from one .glx file. A .glx file is to geocoding what a .pmtiles archive is to tiles. geolith search serves it as tileserver-rs serves .pmtiles.

Build the file

geolith builds the file from Overture Maps and an OpenStreetMap extract:

geolith --data ./overture --osm-pbf ./india-latest.osm.pbf \
  --output ./india.pmtiles \
  --output-format geocoding --geocoding-output ./india.glx

--geocoding-format glx is the default. See the geolith geocoding guide.

To look inside a file before you serve it, open it in the .glx viewer: drop a local file or paste an https URL (the host must allow CORS and Range), then run search, autocomplete, reverse, nearby and place queries in the browser. The file is read in byte ranges and never uploaded.

System requirements

TaskMemoryDisk
Build India (6.2 million places)4.9 GB peak, measured32.5 GB peak, measured (SSD)
Build the planet (652 million places)5.2 GB peak, measuredabout 231 GB peak, measured (SSD)
Serve India6 MB measured, plus page cache1.1 GB (the file)
Serve the planet55 MB measured, plus page cache84 GB (the file)

The planet build took 7 hours 35 minutes with a saved OSM node store; the node pass adds about 1.6 hours.

The build keeps its large data on disk, so a laptop can build a country. Most of the disk holds the OSM node store: a sparse file with a slot for every OSM node id, so it needs a filesystem with sparse files, such as APFS or ext4. A node store in the temporary directory is removed after the OSM pass. See geolith system requirements.

The server reads the file in blocks and does not load it into memory. The operating system page cache holds the blocks that queries read, so more free memory gives faster cold queries, but it is not required.

What the file holds

  • A term dictionary and posting lists with BM25 statistics.
  • Stored word prefixes for autocomplete: posting lists for prefixes of 4 to 6 characters, and a short list of the most important places for each prefix of 2 or 3 characters.
  • The layer, country and position of each place in the posting lists. layers, boundary.country and focus filters apply before place records are read.
  • A spatial index: place positions in Hilbert order, in blocks with bounding boxes. Reverse and focus use it.
  • Place records in zstd blocks of 1,024 places.

Size

The India file holds 6,382,829 places in 542 MB. It was built in 15 minutes.

The planet file holds 652,242,366 places (555.6 million from Overture, 96.6 million from OSM) in 84 GB.