Skip to content

Guide

Self-host the geolith router from a .glx file (in development)

The router running next to your own .glx file.

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

The router running next to your own .glx file.

You need

A routing .glx file

routing .glxYour routerBlocks it needsRoute response
The router reads only the blocks a request touches. geolith hosts no router.

Status: routing is in development and not deployed. There is no router to download, no hosted endpoint, and no routing plan, price or key. This guide describes how the router runs so you can plan a deployment.

The geolith router answers Valhalla-compatible routing requests from one .glx file with a routing part, and nothing else: no database, no graph to load into memory before the first request.

What you need

  1. A .glx file with a routing part, written by the builder: see build a routing .glx file.
  2. Somewhere to keep the file: an R2 bucket for a Cloudflare Worker, or local disk for a server.
  3. The router. It is a Rust library with no I/O of its own: it asks for the bytes a request needs and the app around it fetches them.

How the router reads the file

At start the router reads the file header, finds the routing part, and keeps the tile index and the zstd dictionary in memory. Each request then fetches only the 64 KiB blocks its search touches:

  • Cloudflare Worker: the router compiled to WebAssembly; the file in R2; one range read per block. Decoded blocks are cached per isolate.
  • Server: the same library next to a file on local disk; one file read per block. A packaged server binary is planned.

The endpoints it serves

PathWhat it answers
/routeA route between two or more points
/sources-to-targetsA time and distance matrix
/isochroneThe area reachable within a time or a distance
/trace-routeA GPS trace snapped to roads, as a route
/trace-attributesThe road attributes along a GPS trace

Bodies are Valhalla's; costing is auto, pedestrian or bicycle. Paths are kebab-case: a Valhalla client needs a new base URL and the path changes in migrate a Valhalla client.

Live speeds and closures

Live speeds and closures are not in the file. The program that runs the router supplies them beside it, so the .glx file stays immutable and cacheable. They apply to requests with a date_time. See traffic and live data.

Keep going

Previous and next

Related

More guides like this

Questions

Quick answers