OpenStreetMap PBF Import
1. Overview
In addition to Overture Maps Foundation (OMF) cloud datasets, BAMBAM can build multimodal road networks directly from local OpenStreetMap (.osm.pbf) extracts (such as regional extracts from Geofabrik).
Both the OMF and OSM import pipelines share the same underlying graph construction engine (bambam-network), ensuring identical output file structures and modeling guarantees:
- Non-Destructive Topological Splitting: OSM ways are split at intersections and simplified to collapse intermediate degree-2 shape nodes while preserving full WKT
LineStringgeometries. - Spatial Infrastructure Attachment: OSM nodes tagged with
traffic_signals,stop,give_way, orcrossingare spatially matched (within 15 meters) to intersection vertices. - Modal Filtering & Island Removal: Ways are filtered by highway class and modal access tags into
walk/,bike/, anddrive/edge lists, and disconnected network islands smaller than 2 miles are pruned. - Drop-In Compatibility: Produces the exact same
bambam.toml,vertices-compass.csv.gz, and<mode>/edges-*.gzlayout as Overture Maps imports.
2. Setup
1. Import an .osm.pbf File (bambam-osm or bambam_util import-network)
Suppose you have downloaded a regional OpenStreetMap extract (e.g., colorado-latest.osm.pbf) and want to build a BAMBAM network clipped to query/denver_470_buffer.txt.
You can run bambam-osm network (or the unified bambam_util import-network --source osm command) using the standard network filter configuration configuration/bambam-network/bambam-network-config.json:
./rust/target/release/bambam-osm network \
--pbf-file /path/to/colorado-latest.osm.pbf \
--configuration-file configuration/bambam-network/bambam-network-config.json \
--extent-file query/denver_470_buffer.txt \
--output-directory denver_osm
(Alternatively, using bambam_util import-network:)
./rust/target/release/bambam_util import-network \
--source osm \
--input-path /path/to/colorado-latest.osm.pbf \
--configuration-file configuration/bambam-network/bambam-network-config.json \
--extent-file query/denver_470_buffer.txt \
--output-directory denver_osm
2. Run BAMBAM
Because the OSM importer generates the standard bambam.toml and modal subdirectories inside denver_osm/, running BAMBAM is identical to the Overture Maps workflow:
cd denver_osm
../rust/target/release/bambam \
--config-file bambam.toml \
--query-file ../query/denver_extent.json
3. What Happens
- PBF Parsing & Polygonal Clipping:
bambam-osmstreams the.osm.pbfbinary file, filtering OSM ways and nodes against the highway classes defined inbambam-network-config.jsonand clipping them to the polygon inquery/denver_470_buffer.txt.
- Raw Parquet Caching & ID Mapping:
- Raw OSM node and way tables are saved to
denver_osm/raw/nodes.parquetanddenver_osm/raw/ways.parquet(allowing fast re-imports via--local-source denver_osmwithout re-parsing the PBF). - Bidirectional mappings between RouteE Compass IDs and OSM Node/Way IDs are written to
vertices-mapping.csv.gzand<mode>/edges-mapping.csv.gz.
- Raw OSM node and way tables are saved to
- Graph Serialization & Execution:
denver_osm/is populated withbambam.toml,summary.toml,vertices-compass.csv.gz, and thewalk/,bike/, anddrive/subdirectories, whichbambamthen loads to execute the grid access study and produceresult.csvandresult.json.