Skip to content

Guide

Build a routing .glx file with the geolith builder (in development)

A routing .glx file built from OpenStreetMap.

Status · In development

In development, not deployed: there is no routing endpoint to call yet, on geolith.app or api.geolith.app, and no routing plan, price or key.

  • 8 min
  • Advanced
  • Updated

By

You will build

A routing .glx file built from OpenStreetMap.

You need

The geolith builder · an OSM extract

OSM extract (.pbf)geolith builderrouting .glxA router
The builder writes the routing part of a .glx file; a router reads it.

Status: routing is in development and not deployed. There is no routing endpoint on geolith.app or api.geolith.app, and no routing plan, price or key. The builder is not distributed yet: this guide shows how geolith builds its own routing files.

The geolith builder turns an OpenStreetMap extract into a road graph and writes it as the routing part of a .glx file. A router reads that one file, with no database. On Berlin, the router answers from geolith-built files with JSON byte-identical to Valhalla 3.9.1 (see routing accuracy).

Build the routing part

bash
geolith --output-format routing \
  --osm-pbf berlin.osm.pbf \
  --routing-output berlin-routing.glx
  • --output-format routing builds the routing graph instead of map tiles.
  • --osm-pbf is the OpenStreetMap extract (.osm.pbf).
  • --routing-output is the .glx file to write. It holds one routing part: a routing header, a tile index, a zstd dictionary and the graph tiles, each cut into 64 KiB blocks that a router reads one range at a time.

Add historical speeds

Pass a directory of speed files and the router uses them for requests with a date_time:

bash
geolith --output-format routing \
  --osm-pbf berlin.osm.pbf \
  --routing-output berlin-routing.glx \
  --routing-predicted-speeds speeds/

The directory holds one CSV file per graph tile, named by its tile path (for example speeds/2/000/753/554.csv), one row per directed edge:

csv
edge_graph_id,free_flow_kph,constrained_kph,encoded_dct
2/753554/120,52,38,AbC...==

The format is the one Valhalla's valhalla_add_predicted_traffic tool reads, so data that already targets Valhalla works unchanged. Edge ids change with every graph build, so map your speeds to edges for each build. The full field list is in the traffic docs.

What the file is for

The routing .glx file is what a self-hosted router serves: see self-host the geolith router from a .glx file. A file can also hold a search part; each reader reads only its own part.

Keep going

Previous and next

Questions

Quick answers