Skip to content

CLI Overview

pbfhogg includes a command-line toolkit for common OSM PBF operations. Install it with:

sh
cargo install pbfhogg-cli

The binary is called pbfhogg. Requires Rust 1.96+.

Commands at a Glance

CommandDescription
inspectFile inspection: metadata, block breakdown, ordering, tag frequencies
checkValidate IDs and referential integrity
catConcatenate PBFs with optional type filtering
sortSort into standard order (nodes, ways, relations by ID)
repackRe-encode a PBF with a configurable per-blob element cap
degradeProduce a valid-but-adversarial PBF for benchmarking non-optimal paths
extractExtract by bounding box or GeoJSON polygon (simple/complete/smart)
tags-filterFilter elements by tag expressions (PBF or OSC input)
exportStream tagged nodes/ways to GeoJSON or GeoJSONSeq
diffCompare two PBFs; --format osc generates an OSC diff
getidExtract or remove elements by ID
getparentsFind ways/relations referencing given IDs
apply-changesApply OSC diff to a sorted PBF with blob passthrough
add-locations-to-waysEmbed node coordinates in ways
renumberRenumber all element IDs sequentially
time-filterFilter history PBF to a point-in-time snapshot
merge-changesMerge multiple OSC files into one
build-geocode-indexBuild reverse geocoding index (S2 cells, mmap-ready)

Common Flags

Most write commands accept:

  • -o, --output <FILE> - output file
  • --compression <SPEC> - none, zlib (default), zstd, or with level (zlib:9, zstd:19)
  • --direct-io - bypass page cache (Linux, requires linux-direct-io feature)
  • --force - proceed without indexdata (slower)

See Commands for the full reference.

Released under the Apache License 2.0. | Copyright folk@folk.wtf