osm-pbf-stream
OpenStreetMap Protocol Buffer Stream
npm
Install via$ npm install --save osm-pbf-stream
Index
What
As OpenStreetMap's .osm.pbf
files aren't pure Protocol Buffer messages, but are in a chunked, size delimited (and optionally, compressed) custom crafted format – this parses out the Protobuf message chunks.
So, osm.pbf
goes in, pbf
comes out.
Usage
var OsmPbf =
var pbfStream = fs
// Now you can process the Protocol Buffer stream// with a streaming Protobuf parser, like `pbs`var pbs = var osmSchema = fsvar messages = var decoder = messagesPrimitiveBlock decoder decoder // Pipe the PBF stream to the decoderpbfStream
Speed
With the ~49 MB test file, it processes about 50 MB/s on a MacBook Pro.
BlobParser
✓ 1MB chunk size (986ms)
✓ Default (16KB) chunk size (1009ms)