Expand description
OSM PBF reader with two-pass processing.
Max node ID (scan_max_node_id): sizes the node store, so a small
regional extract does not allocate a 97 GB store. A PBF whose header
declares Sort.Type_then_ID (Geofabrik extracts and the planet file) is
answered from its last node blob, found by a binary search over blob
headers; any other PBF gets a full parallel scan.
Pass 1 (pass1_nodes_and_relations): Single parallel scan that
simultaneously collects every node coordinate into a dense NodeStore
AND preprocesses boundary/route relations into a way→relation lookup.
The node store is sized to fit the actual max node ID found during pre-scan.
Pass 2: Process ways and relations into InputFeatures.
Ways are reconstructed from node coordinates in the store.
The pipeline uses parallel blob processing (BlobReader::par_bridge)
for maximum throughput.
Structs§
- Collected
Relation - Relation info collected during preprocessing.
- Node
Collection Stats - Result of pass 1: statistics about nodes collected.
- Pass1
Result - Result of pass 1: relation data collected alongside nodes.
Enums§
- Relations
- Whether pass 1 collects the boundary and route relations of each way.
Functions§
- element_
to_ feature - Convert a single OSM element to an
InputFeature, if applicable. - pass1_
nodes_ and_ relations - Run pass 1: collect nodes AND preprocess relations in a single PBF read.
- pass1_
or_ cached - Pass 1, or with
use_cachethe node store of an earlier run when its sidecar metadata still matchessource_pbf(then only the relations are read again). A fresh pass 1 withuse_cachewrites that metadata, so the next run can skip the node scan: hours on a planet file. - preprocess_
relations - Preprocess OSM relations to build a way→relation lookup table.
- scan_
max_ node_ id - Find the maximum node ID of a PBF file.
- sorted_
max_ node_ id - The largest node id of a PBF sorted by type then id, or
Nonewhen the header does not declare that order. - tags_
to_ properties - Convert OSM tags to property map.