Scheduled Transit (GTFS)
1. Overview
Public transit operates on fixed routes and published timetables rather than continuous, on-demand roadway speeds. Modeling transit accessibility requires capturing:
- First- and last-mile access: Walking from an origin to a transit stop, walking between stops to transfer routes, and walking from the alighting stop to the final destination.
- Schedule-dependent waiting and in-vehicle travel: A traveler arriving at a transit stop at time \(t\) must wait until the next scheduled departure \(t_{\text{dep}} \ge t\) on that route before traversing the stop-to-stop link and arriving at \(t_{\text{arr}}\).
BAMBAM models scheduled public transit using GTFS (General Transit Feed Specification) feeds. It snaps GTFS stops to vertices on the road network, builds a dedicated transit edge list representing stop-to-stop service patterns, compiles active departures within a target date and time window into a high-speed binary timetable (edges-schedules.rkyv), and couples the walk and transit networks into a multimodal graph.
2. Setup
Building the Transit Network (bambam_build_open_data.sh)
In script/bambam_build_open_data.sh, stages 2 through 4 (gtfs-download, gtfs-import, and gtfs-config) download GTFS archives from a Mobility Data Catalog CSV manifest, compile the transit edge list and schedule tables into denver_buf/transit/, and generate denver_buf/bambam_gtfs.toml:
./script/bambam_build_open_data.sh \
--extent-file query/denver_470_buffer.txt \
--output-dir denver_buf \
--gtfs-manifest path/to/mobility_catalog_manifest.csv \
--subdivision-name "Colorado" \
--from-stage network \
--to-stage gtfs-config
Under the hood, these stages run:
bambam-transit download: Downloads GTFS.zipfeeds matching the country/subdivision filter intodenver_buf/gtfs/.bambam-transit import: Filters feeds to the study extent, maps service calendars to the target date/time window (e.g.,08:00:00to09:00:00), snaps stops tovertices-compass.csv.gz, and writesdenver_buf/transit/edges-compass.csv.gzanddenver_buf/transit/edges-schedules.rkyv.bambam_util gtfs-config: Readsdenver_buf/bambam.tomland writesdenver_buf/bambam_gtfs.tomlwith thetransitedge list,transitschedule traversal model, and"transit"multimodal label injected.
Modifying bambam_gtfs.toml
To evaluate transit trips during your target departure window, ensure bambam_gtfs.toml includes:
- A
start_datetimeinput plugin so schedule lookups know when the trip begins:[[plugin.input_plugins]] type = "inject" format = "key_value" write_mode = "overwrite" key = "start_datetime" value = "2025-09-01 08:00:00" - A
transitmode entry under thetrip_modesinput plugin defining the multimodal leg rules (such as a maximum of 4 legs, up to 10 minutes of walking, and at least 3 minutes on transit):[plugin.input_plugins.modes.transit] multimodal_label = true max_trip_legs = 4 constraints = [ { type = "mode_time_limit", mode = "walk", max = 10.0, unit = "minutes" }, { type = "mode_leg_time_limit", mode = "transit", min = 3.0, unit = "minutes" }, { type = "allowed_modes", values = ["walk", "transit"] }, ]
Running BAMBAM
cd denver_buf
../rust/target/release/bambam \
--config-file bambam_gtfs.toml \
--query-file ../query/denver_extent.json
3. What Happens
- Multimodal Graph Construction:
- BAMBAM loads the
walk,bike,drive, andtransitedge lists over the shared vertex set (vertices-compass.csv.gz). Because GTFS stops were snapped to road network vertices duringgtfs-import, travelers can seamlessly transition betweenwalkedges andtransitedges at any transit stop vertex.
- BAMBAM loads the
- Schedule-Aware Tree Search:
- For each grid cell’s
transitquery, the search starts atstart_datetime(e.g., 8:00 AM) on thewalknetwork. - When the search reaches a vertex with outgoing
transitedges, it transitions fromwalktotransit(incrementing the trip leg counter). - The
transittraversal model consultstransit/edges-schedules.rkyvto find the earliest departure at or after the traveler’s current arrival time at that stop. The link travel time is computed as: \[\Delta t = (t_{\text{departure}} - t_{\text{arrival}}) + (t_{\text{next\_stop}} - t_{\text{departure}})\] capturing both schedule wait/transfer time and in-vehicle travel time. - At downstream stops, the traveler can either stay aboard the transit vehicle, transfer to another transit route, or alight back onto the
walknetwork to reach final destinations, subject to the 10-minute total walk limit and 40-minute total trip time limit.
- For each grid cell’s
- Output Aggregation:
- Reached destinations and opportunities along the multimodal walk+transit tree are binned into 10-, 20-, 30-, and 40-minute intervals and written to
result.csvandresult.jsonwithmode = "transit".
- Reached destinations and opportunities along the multimodal walk+transit tree are binned into 10-, 20-, 30-, and 40-minute intervals and written to