Congestion Imputation
1. Overview
Default open road networks (from Overture Maps or OpenStreetMap) provide posted speed limits or functional road-class default speeds. However, real-world driving accessibility varies significantly by time of day due to traffic congestion—a 30-minute morning peak commute (wd-am) covers a much smaller travel shed than a 30-minute Sunday afternoon drive (we-af).
When empirical probe speed data (such as a commercial reference network) is available for a calibration region, BAMBAM’s congestion imputation pipeline transfers those observed congestion patterns onto the open road network across six standard time-of-day bins:
- Weekday (
Wednesday): Morning Peak (wd-am, 08:00–09:00), Midday (wd-af, 10:00–11:00), Evening Peak (wd-pm, 17:00–18:00) - Weekend (
Sunday): Morning (we-am, 08:00–09:00), Afternoon (we-af, 10:00–11:00), Evening (we-pm, 17:00–18:00)
The pipeline conflates reference network links onto the open road network, computes surrounding land-use, demographic, and network topology features (such as intersection control density, POI activity density, and census population/employment density within a 0.5-mile radius), trains gradient-boosted tree (XGBoost) models, and imputes time-period-specific operating speeds for every drivable link in the open network.
2. Setup
1. Run the Congestion Pipeline Stages (bambam_build_open_data.sh)
In script/bambam_build_open_data.sh, stages 5 through 9 (census, opportunities, calibrate, train, and impute) execute the full congestion workflow. You must provide --ref-network-dir pointing to the reference speed dataset (and optionally --ref-speeds-dir if speed files are stored separately):
export CENSUS_API_TOKEN="<your-census-api-key>"
./script/bambam_build_open_data.sh \
--extent-file query/denver_470_buffer.txt \
--output-dir denver_buf \
--ref-network-dir /path/to/reference_network \
--from-stage census \
--to-stage impute
(Ensure network stage has already been run for denver_buf/, or set --from-stage network --to-stage impute to run both network import and congestion imputation together.)
This produces six enumerated speed tables inside denver_buf/drive/:
drive/edges-speeds-wd-am-mph-enumerated.txt.gzdrive/edges-speeds-wd-af-mph-enumerated.txt.gzdrive/edges-speeds-wd-pm-mph-enumerated.txt.gzdrive/edges-speeds-we-am-mph-enumerated.txt.gzdrive/edges-speeds-we-af-mph-enumerated.txt.gzdrive/edges-speeds-we-pm-mph-enumerated.txt.gz
2. Point bambam.toml to a Congested Speed Table
In denver_buf/bambam.toml, update speed_table_input_file under the Drive Topology [[search]] block to reference the desired time bin (for example, weekday morning peak wd-am):
###
### DRIVE TOPOLOGY
###
[[search]]
traversal.type = "combined"
traversal.models = [
{ type = "distance", distance_unit = "miles" },
{ type = "speed", speed_unit = "mph", speed_table_input_file = "drive/edges-speeds-wd-am-mph-enumerated.txt.gz" },
{ type = "time", time_unit = "minutes" },
{ type = "multimodal", this_mode = "drive", available_modes = ["walk", "bike", "drive"] }
]
3. Run BAMBAM
cd denver_buf
../rust/target/release/bambam \
--config-file bambam.toml \
--query-file ../query/denver_extent.json
3. What Happens
- Feature Extraction (
census&opportunitiesstages):bambam-congestion export-censusdownloads Census tract geometries, population, and employment intodenver_buf/census_tracts_bamcensus.csv.gz.bambam-congestion export-opportunitiesdownloads Overture Maps POIs and buildings intodenver_buf/opportunities_omf.csv.gz.
- Conflation & Calibration (
calibratestage):bambam-congestion calibratespatially matches reference road segments todenver_buf/drive/edges-complete.csv.gz(using a 5-meter buffer and \(45^\circ\) maximum heading difference), attaches 0.5-mile geodesic spatial density features and vertex traffic-control attributes, and writes training tables todenver_buf/congestion_calibration/.
- Model Training (
trainstage):train_congestion_models.pytrains two XGBoost models (xgboost_model_with_speedlimit.jsonfor links with known posted speed limits, andxgboost_model_without_speedlimit.jsonfor links without posted speed limits) and saves them todenver_buf/congestion_models/.
- Network Speed Imputation & Routing (
imputestage +bambam):bambam-congestion imputeevaluates the trained XGBoost models across every link indenver_buf/drive/for all six time bins and writes the enumerated.txt.gzspeed tables.- When
bambamruns withedges-speeds-wd-am-mph-enumerated.txt.gz, drive tree searches use the imputed weekday AM peak operating speeds on every roadway link, reflecting realistic peak-hour travel times and contracted peak-hour isochrones.