Module osm.io.pbf.reader
Consumer-facing orchestration for complete in-memory OSMPBF files.
PbfReader composes the existing framing, Blob, HeaderBlock, PrimitiveBlock, PrimitiveGroup, and element decoders into one semantic read operation. It does not materialize an owned OSM model. Element views remain borrowed from the input or reusable workspace and are valid only for the duration of the synchronous callback that receives them.
PbfReaderWorkspace owns reusable scratch storage used for decompression, StringTable indexing, and regular-Way preflight plans. The first read may grow that storage through the D garbage collector; subsequent reads reuse the retained capacity whenever it is sufficient.
Date
2026-11-01
Functions
| Name | Description |
|---|---|
pbfNodes(input)
|
Return a foreach adapter over semantic Nodes in one PBF input. |
pbfRelations(input)
|
Return a foreach adapter over semantic Relations in one PBF input. |
pbfWays(input)
|
Return a foreach adapter over semantic Ways in one PBF input. |
readPbf(input, handler)
|
Decode one complete PBF with a temporary reader workspace. |
readPbf(source, handler)
|
Decode one complete PBF from a generic ByteSource with temporary scratch. |
where(source)
|
Filter one PBF Node foreach traversal with a compile-time predicate. |
where(source)
|
Filter one PBF Way foreach traversal with a compile-time predicate. |
where(source)
|
Filter one PBF Relation foreach traversal with a compile-time predicate. |
Structs
| Name | Description |
|---|---|
PbfNodeIterable
|
Foreach adapter over semantic OSM nodes in one already-loaded PBF file. |
PbfReader
|
Whole-buffer OSMPBF reader. |
PbfReaderWorkspace
|
Reusable scratch storage for PbfReader. |
PbfReadResult
|
Result of the one-shot readPbf convenience operation.
|
PbfReadStatus
|
Diagnostic for one complete-file PBF read. |
PbfReadSummary
|
Counts from one successfully completed PbfReader.read operation. |
PbfRelationIterable
|
Foreach adapter over semantic OSM Relations in one already-loaded PBF file. |
PbfSourceReadResult
|
One-shot result for a ByteSource-backed PBF read. |
PbfSourceReadStatus
|
Combined transport/PBF diagnostic for one ByteSource-backed PBF read. |
PbfWayIterable
|
Foreach adapter over semantic OSM Ways in one already-loaded PBF file. |
PbfWhereIterable
|
Push-filter adapter over one element-specific PBF foreach traversal. |
Enums
| Name | Description |
|---|---|
PbfReadError
|
High-level category of a complete-file PBF read failure. |