You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert OpenStreetMap PBF bytes to ergonomic JSON entities (and back again) for streaming editors, change workflows, and browser-based tooling. Builds on @osmix/pbf primitives while staying friendly to modern runtimes.
Highlights
Decode.osm.pbf streams into header metadata and strongly typed node/way/relation JSON.
Encode JSON entities back into spec-compliant PBF blobs with automatic string tables and delta encoding.
Stream using Web Stream transforms to keep large datasets out of memory.
Compose with other Osmix packages for complete read-modify-write workflows.
Installation
bun add @osmix/json
Usage
Decode a PBF stream
import{osmPbfToJson}from"@osmix/json"import{toAsyncGenerator}from"@osmix/pbf"conststream=osmPbfToJson(Bun.file('./monaco.pbf').stream())forawait(constitemoftoAsyncGenerator(stream)){if("id"initem){// item is OsmNode | OsmWay | OsmRelationconsole.log(item.id,item.tags?.name)}else{// item is OsmPbfHeaderBlockconsole.log("Features:",item.required_features)}}