Skip to content
open-geocodeopen-geocodeopen-geocode
GitHub

Build a Pack

A Pack is the one file og answers from. It holds the records, their text index and their spatial index.

Use og build to download a region’s OpenStreetMap extract and build a Pack from it.

Terminal window
og build --region canada/ontario

--region takes a catalog id, such as canada/ontario or germany. To browse the catalog, run og with no arguments.

To build one Pack that covers several regions and is served by one process, repeat --region.

Terminal window
og build --region canada/ontario --region canada/quebec --name canada-east

--name sets what the Pack is called. It defaults to the region ids joined together.

OpenStreetMap does not have every address. To fill the gaps, add --openaddresses.

Terminal window
export OA_TOKEN=...
og build --region canada/ontario --openaddresses

og adds the OpenAddresses points for the countries the Pack covers, leaving out addresses OpenStreetMap already has. It needs an OpenAddresses API token in OA_TOKEN.

Before it starts, og checks that the machine has enough memory and disk for the build. These flags change what it may use.

Sets the memory, in MiB, for the build’s buffers. When it is not set, og sizes the budget to what the machine can spare.

Terminal window
og build --region germany --memory-budget-mb 8192

Sets the most scratch disk, in MiB, the build may hold at once. As the build nears the cap, it compresses its spill harder. If it still can’t fit, it stops early.

Builds even when the pre-flight check finds too little memory or disk.

Press Ctrl-C to stop a build. og keeps its last checkpoint, so you can pick it up again. Press Ctrl-C twice to quit at once.

Continues a stopped build of this Pack from its last checkpoint. If there is no checkpoint, it starts over.

Terminal window
og build --region canada/ontario --resume

Clears what a stopped build left behind, and starts over.

Downloads the extract again, even if one is already on disk.

og keeps its files in its home directory. That is OG_HOME if it is set, otherwise the platform’s local data directory, such as ~/.local/share/open-geocode on Linux or ~/Library/Application Support/open-geocode on macOS.

<home>/pbf/<region id>.osm.pbf a downloaded extract
<home>/packs/<region slug>/ a Pack
<home>/builds.jsonl one line per finished build

A Pack built from OpenStreetMap is a derivative of ODbL-licensed data. Every API response carries the attribution © OpenStreetMap contributors, ODbL. Follow the license terms of the data you build from.