Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.gz
  • drive/edges-speeds-wd-af-mph-enumerated.txt.gz
  • drive/edges-speeds-wd-pm-mph-enumerated.txt.gz
  • drive/edges-speeds-we-am-mph-enumerated.txt.gz
  • drive/edges-speeds-we-af-mph-enumerated.txt.gz
  • drive/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

  1. Feature Extraction (census & opportunities stages):
    • bambam-congestion export-census downloads Census tract geometries, population, and employment into denver_buf/census_tracts_bamcensus.csv.gz.
    • bambam-congestion export-opportunities downloads Overture Maps POIs and buildings into denver_buf/opportunities_omf.csv.gz.
  2. Conflation & Calibration (calibrate stage):
    • bambam-congestion calibrate spatially matches reference road segments to denver_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 to denver_buf/congestion_calibration/.
  3. Model Training (train stage):
    • train_congestion_models.py trains two XGBoost models (xgboost_model_with_speedlimit.json for links with known posted speed limits, and xgboost_model_without_speedlimit.json for links without posted speed limits) and saves them to denver_buf/congestion_models/.
  4. Network Speed Imputation & Routing (impute stage + bambam):
    • bambam-congestion impute evaluates the trained XGBoost models across every link in denver_buf/drive/ for all six time bins and writes the enumerated .txt.gz speed tables.
    • When bambam runs with edges-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.