-
Notifications
You must be signed in to change notification settings - Fork 0
Create Bus Layers
ccai-cmap edited this page Dec 15, 2025
·
16 revisions
This page describes 3_create_bus_layers.py, which creates bus layers for different scenarios. To use this tool, run
python [path-to-tool].
This script is a translation of the first half of the Generate Transit Files tool in the mhn_programs repository.
Note: Before you run this tool, you MUST have already have run the Export Future Highways tool, so that your output folder already contains MHN_all.gdb.
input
|-- input_years.csv
`-- 1_travel
`-- MHN.gdb
output
`-- 1_travel
`-- MHN_all.gdb
The script runs in two main steps. The first step is not concerned with scenarios, while the second step builds the bus network for a specified set of scenarios.
- A GDB called collapsed_routes.gdb is created.
- Within that GDB, for each transit TOD (1, 2, 3, 4), the bus_base and bus_current feature classes (both GTFS) are partitioned according to the TOD period their runs fall into.
- For each TOD period, similar runs are collapsed / grouped together (similar meaning the runs share the same MODE-ROUTE_ID and have similar stopping patterns), and a representative run is chosen for each group (the run which is longest then starts earliest). The headway is calculated for each group.
- For representative runs, the corresponding itinerary is imported into the GDB and checked for errors. Itinerary gaps and false links are noted and written to the error file error_file_1.txt.
- We can think of the bus_future feature class as already being in its collapsed state. The corresponding future itineraries are imported and checked for errors the same way as the GTFS itineraries, with itinerary gaps and false links being noted and written to the error file error_file_1.txt.
- The park and ride nodes are imported into the GDB.
For each scenario and transit TOD:
- The available highway network is found. This is the collection of links and nodes which are available in that scenario and at that TOD. Buses can only travel on the links on this network.
- The GTFS runs are combined with the added and replaced future runs (added means that the run is added, replaced means that this new run replaces old runs with the specified MODE-ROUTE_ID combination). For added and replaced runs, the headway is calculated through a rather convoluted process.
- The corresponding itineraries are modified to satisfy the following requirements:
- If the MODE-ROUTE_ID specifies that the line should be rerouted, a reroute is performed. Lines which were unable to be rerouted are written to error_file_2.txt.