Migrating from osmium-tool to pbfhogg
This guide maps osmium-tool commands and flags to their pbfhogg equivalents. If you're already familiar with osmium, you should feel at home - most commands have the same names and flags, with a few consolidations that reduce the total command count.
Quick reference
| osmium | pbfhogg | What changed |
|---|---|---|
cat | cat | Same |
sort | sort | Same |
extract | extract | --strategy replaced by --simple / --smart flags; membership per strategy in DEVIATIONS |
tags-filter | tags-filter | Also handles OSC input (see below) |
export | export | GeoJSON/GeoJSONSeq only; nodes and ways only (see below) |
getid | getid | pbfhogg also accepts named type/ID forms; bare IDs need --default-type. Use inspect --show <TYPE_ID> to display one element by ID. |
getparents | getparents | Bare IDs need --default-type in pbfhogg |
renumber | renumber | Same |
add-locations-to-ways | add-locations-to-ways | Same |
time-filter | time-filter | Same |
diff | diff | Content equality instead of version ordering (see DEVIATIONS) |
apply-changes | apply-changes | Same |
merge-changes | merge-changes | Same |
fileinfo | inspect | Different name, more capabilities |
check-refs | check --refs | Consolidated into check |
merge | cat --dedupe | Consolidated into cat |
derive-changes | diff --format osc | Consolidated into diff |
removeid | getid --invert | Consolidated into getid |
tags-count | inspect tags | Consolidated into inspect |
Consolidated commands
pbfhogg merges several osmium commands that do closely related things. The underlying functionality is identical - only the CLI entrypoint changed.
check-refs is now check
pbfhogg's check command validates both ID integrity and referential integrity in a single pass by default.
# osmium
osmium check-refs input.pbf
osmium check-refs -r input.pbf
# pbfhogg
pbfhogg check input.pbf # runs both ID + ref checks
pbfhogg check input.pbf --refs # ref check only (same as osmium check-refs)
pbfhogg check input.pbf --refs --check-relations # same as osmium check-refs -r
pbfhogg check input.pbf --refs --show-ids # show missing refs (n123 in w456)
pbfhogg check input.pbf --ids # ID uniqueness/ordering only
pbfhogg check input.pbf --json # machine-readable outputCounting difference: For missing node refs in ways and missing relation-to-relation members, osmium reports the number of broken references (occurrences), while pbfhogg reports unique missing IDs with the occurrence count in parentheses when they differ: Missing node refs in ways: 1 (2 references), Missing relation members: 706 (777 references). Both tools find the same set of missing IDs.
removeid is now getid --invert
# osmium
osmium removeid -o out.pbf input.pbf n123 w456
# pbfhogg
pbfhogg getid --invert -o out.pbf input.pbf n123 w456All ID source flags (-i, -I, --default-type) work in both normal and inverted mode. The getid-only flags (-r, -t, --verbose-ids) are not available with --invert.
getid and getparents ID syntax
Both pbfhogg commands accept the compact n123, w456, r789 forms and the named node/123, way/456, relation/789 forms. Osmium accepts the compact forms. Osmium defaults a bare numeric ID to a node; pbfhogg requires --default-type to assign a kind to a bare number. The same default rule applies to --id-file text input.
derive-changes is now diff --format osc
# osmium
osmium derive-changes old.pbf new.pbf -o changes.osc
# pbfhogg
pbfhogg diff --format osc old.pbf new.pbf -o changes.osc
pbfhogg diff --format osc old.pbf new.pbf -o changes.osc --increment-version
pbfhogg diff --format osc old.pbf new.pbf -o changes.osc --update-timestampText diff (the default --format text) and OSC diff have separate flag sets. Text-only flags (-c, -v, -s, -t) are rejected with --format osc, and vice versa for --increment-version / --update-timestamp. The global -q works with both: a quiet text diff answers by exit code alone, a quiet OSC diff still writes its -o.
Changes by content: pbfhogg's diff --format osc decides what changed by content, not by version and timestamp as osmium's derive-changes does, and roundtrips content - applying the derived OSC to the old PBF gives a file diff finds identical to the new PBF (metadata, which diff ignores, is outside that check). Both tools write a delete for every object only the old file holds (see DEVIATIONS).
merge is now cat --dedupe
osmium's merge (sorted k-way merge with dedup) is cat --dedupe in pbfhogg. Plain cat remains concatenation without dedup, just like osmium's cat. Among copies of one type, ID and version, pbfhogg keeps the earliest input's and never reads the timestamp, where osmium keeps the later timestamp; and pbfhogg does not refuse a repeated ID and version inside one input.
# osmium
osmium merge -o merged.pbf a.pbf b.pbf c.pbf
# pbfhogg
pbfhogg cat --dedupe -o merged.pbf a.pbf b.pbf c.pbfAll inputs must be sorted. Unsorted input is a hard error - run pbfhogg sort first if needed.
tags-count is now inspect tags
# osmium
osmium tags-count input.pbf highway
osmium tags-count -t way -s count-desc --min-count 100 input.pbf
# pbfhogg
pbfhogg inspect tags input.pbf highway
pbfhogg inspect tags input.pbf -t way --sort count-desc --min-count 100Each short flag has one meaning across all pbfhogg subcommands, so some of osmium's per-command shorts are long-only here and refuse naming the long flag: tags-count -s is --sort, tags-filter -i / -t are --invert-match / --remove-tags, getid -t is --remove-tags, getparents -s is --add-self, renumber -s is --start-id, extract -c is --config, cat -c is --clean, and fileinfo -e (inspect) is --extended.
The rows are osmium's: with no expression, or for an expression without = (highway), each key is counted alone and printed as count, TAB, "key"; an expression with = (highway=*, highway=primary) counts key=value pairs, printed with the value as a third field. The text is quoted differently: osmium doubles a quote inside a key or value, pbfhogg writes a JSON string literal (backslash escapes). With -e FILE and no positional expression, osmium also counts every key; pbfhogg counts only what the file names. Both differences are recorded in DEVIATIONS.md, "tags-filter and inspect tags: expression-syntax edge cases".
pbfhogg also accepts the tags-filter type-prefix syntax in these expressions. For example, w/highway counts the highway key on ways. Osmium's tags-count treats that full string as a tag matcher; use -t way there to restrict the element kind.
tags-filter-osc is now tags-filter --input-kind osc
pbfhogg auto-detects OSC vs PBF input by content sniffing and file extension, so in most cases you don't need to specify --input-kind at all.
# osmium (separate command)
osmium tags-filter -o out.osc changes.osc.gz highway=primary
# pbfhogg (same command, auto-detected)
pbfhogg tags-filter -o out.osc changes.osc.gz highway=primary
# explicit override if needed
pbfhogg tags-filter --input-kind osc -o out.osc changes.osc.gz highway=primaryOSC mode always preserves deletes. PBF-only flags (-R, -i, -t) are rejected in OSC mode.
export
# osmium
osmium export -o out.geojson input.pbf
# pbfhogg
pbfhogg export input.pbf -o out.geojson --format geojson
pbfhogg export input.pbf # geojsonseq to stdout, the defaultScope differences: pbfhogg's export only emits GeoJSON / GeoJSONSeq (osmium also supports text, JSON, and OPL output formats). Only tagged nodes (as Points) and tagged, closed-or-open ways (as Polygons or LineStrings) are exported - relation features are never emitted, and untagged nodes/ways are skipped. Way export requires the input header to declare LocationsOnWays; --type node works without it. See Commands for filter, property, bbox, and metadata flags.
fileinfo is now inspect
# osmium
osmium fileinfo input.pbf
osmium fileinfo -e input.pbf
osmium fileinfo -g header.boxes input.pbf
osmium fileinfo -j input.pbf
# pbfhogg
pbfhogg inspect input.pbf
pbfhogg inspect --extended input.pbf
pbfhogg inspect -g header.bbox input.pbf
pbfhogg inspect --json input.pbfpbfhogg's inspect also includes capabilities not in osmium:
--indexed- check if a PBF has blob-level indexdata (exit code 0/1)--nodes- coordinate statistics for compression analysis--anomalies- highlight unusual blocks
Flag differences
Most flags are identical between osmium and pbfhogg. Here are the differences worth knowing about.
Different flag names
| osmium | pbfhogg | Commands |
|---|---|---|
-t, --object-type | -t, --type | cat, diff, inspect tags, check |
--strategy simple|complete_ways|smart | --simple / --smart (default: complete) | extract |
-O, --overwrite | -O, --overwrite, as in osmium: an existing output is refused without it. Unlike osmium a symlink is refused even with it | every command with an output |
-p, --polygon (accepts .poly, GeoJSON, or OSM file) | -p, --polygon (GeoJSON only: bare Polygon/MultiPolygon geometry, Feature, or FeatureCollection - every feature, unioned, where osmium takes the first; Osmosis .poly files are not accepted. Each ring needs at least three positions and a non-zero area, and each coordinate must lie in the WGS84 domain before rounding; an open ring is closed implicitly; a polygon may cross the antimeridian) | extract |
For extract polygons, pbfhogg does not validate ring self-intersections. Membership is osmium's integer rule, so accepted self-crossing rings are decided by the same crossing parity as in osmium's extractor, node for node. The non-zero-area check still rejects rings whose signed area cancels to zero, including a symmetric bow-tie. See DEVIATIONS.md.
Flags pbfhogg doesn't have
These osmium flags have no pbfhogg equivalent:
| Flag | Reason |
|---|---|
-F, --input-format | pbfhogg is PBF-only by design |
-f, --output-format | PBF output only (except diff --format osc and merge-changes) |
-v, --verbose | No per-command verbosity control |
--progress / --no-progress | No progress bars |
--fsync | Always enabled (no flag needed) |
-H, --with-history | Current-snapshot tool, no history file support |
--buffer-data | Pipelined writer handles buffering internally |
extract -S, --option | Strategy options are fixed: complete-ways always includes parent relations (osmium's relations=true), smart completes multipolygon and boundary (osmium's types=multipolygon,boundary), with no complete-partial-relations or tags filter. See DEVIATIONS.md |
--index-type | auto (default; runtime routing between the other two, see reference/pipeline.md), sparse, external (bounded-memory join with sequential I/O). Different valid values from osmium's -i, --index-type. |
Flags only pbfhogg has
| Flag | Commands | Purpose |
|---|---|---|
--force | Most commands | Run without indexdata (slower fallback) |
--direct-io | Most commands | Bypass page cache via O_DIRECT |
--io-uring | apply-changes, cat (plain passthrough and --dedupe), sort | io_uring output I/O |
--compression | Most write commands | none, zlib (default; renumber defaults to zlib:1), zstd, with optional level (zlib:9) |
--generator | Most write commands | Set writing program name in output header |
--output-header | Most write commands | Set replication header fields |
--json | inspect, check | Machine-readable output |
--index-type | add-locations-to-ways | auto (default), sparse, external (different values from osmium's -i) |
--inject-prepass | add-locations-to-ways | Emit opt-in pbfhogg.WayMembers-v1 / pbfhogg.SharedNodePins-v1 metadata for downstream reuse |
Commands pbfhogg doesn't have
| osmium command | Status |
|---|---|
changeset-filter | Not planned. Changeset processing is a niche use case. |
create-locations-index / query-locations-index | Not needed. pbfhogg builds indexes in-memory via anonymous mmap. |
show | No equivalent. Osmium pages through the file in a text format. |
Indexdata
pbfhogg can embed blob-level indexdata into PBF files, enabling fast passthrough for commands like apply-changes, sort, and extract. This has no osmium equivalent.
To create an indexed PBF:
pbfhogg cat input.pbf -o indexed.pbfThe passthrough path (no --type filter) adds indexdata via decompress+scan without re-compressing blobs - minimal memory, suitable for planet-scale files.
Commands that benefit from indexdata will error if it's missing. Use --force to run anyway (slower). Check if a file is indexed:
pbfhogg inspect --indexed input.pbf # exit code 0 = indexed, 1 = not