Skip to content

Rjf/preprocess stop matchnig#111

Merged
robfitzgerald merged 14 commits intomainfrom
rjf/preprocess-stop-matchnig
Mar 6, 2026
Merged

Rjf/preprocess stop matchnig#111
robfitzgerald merged 14 commits intomainfrom
rjf/preprocess-stop-matchnig

Conversation

@robfitzgerald
Copy link
Collaborator

@robfitzgerald robfitzgerald commented Feb 26, 2026

overview

this PR brings additional features to GTFS importing in BAMBAM

  • if a GTFS Trip has a Stop which fails to map match (due to distance tolerance), the Trip is removed
    • this will address Honolulu bus system import that failed due to mtn roads
    • replaces existing code for applying the MissingStopLocationPolicy
  • the user can pass an extent into the CLI
    • this means we can always pass the Mobility Database CSV manifest and downsample archives with geometries
  • fixes to bambam_util gtfs-config
    • serialize the template traversal/constraint models from record types instead of from raw JSON to avoid missing API changes (use compiler in-the-loop to guarantee correctness)
    • use the routee-compass CompassAppConfig::try_from command to ensure we are building with proper config defaults inherited from this file

explanation

these fixes were used to support running a MEP run for Honolulu, Oahu, Hawaii. the bus system map here includes routes/trips that travel over the tops of the hills in the Koolau Range:

Screenshot 2026-02-27 at 1 40 13 PM

the map data and GTFS stop location data were not aligning within our required distance tolerance of 325 meters, which caused this archive to fail on import. by simply removing trips with stops outside of this threshold, this archive could be imported. the cost here is the lack of simulation of those trips, but, that seems first and foremost to be an issue with our network dataset.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances GTFS import/preprocessing to better handle problematic feeds (e.g., stops that can’t be map-matched within tolerance) and adds optional spatial downsampling via an extent filter. It also updates the gtfs-config generator to rely more on typed config serialization and Compass default config loading.

Changes:

  • Update bambam_util gtfs-config to load Compass config via CompassAppConfig::try_from(...) and build traversal/constraint model JSON from typed structs (plus a "type" tag).
  • Add GTFS preprocessing that removes trips referencing stops that fail vertex map-matching, and allow filtering entire archives by a user-provided WKT extent.
  • Add a GtfsBundle::empty() constructor and adjust bundle processing to return Option<GtfsBundle>.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
rust/bambam/src/app/gtfs_config/run.rs Switches to Compass config loading defaults and generates traversal/constraint JSON via typed configs + "type" tagging helper.
rust/bambam-gtfs/src/schedule/gtfs_bundle.rs Adds an empty() constructor for GtfsBundle.
rust/bambam-gtfs/src/schedule/bundle_ops.rs Adds GTFS pre-read filtering (drop trips with disconnected stops), adds optional extent filtering, and changes processing pipeline to return Option<GtfsBundle>.
rust/bambam-gtfs/src/schedule/app/operation.rs Adds --extent-file CLI option, parses WKT geometry, and integrates extent filtering into preprocessing workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@robfitzgerald robfitzgerald requested a review from yamilbknsu March 3, 2026 18:48
Copy link
Collaborator

@yamilbknsu yamilbknsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@robfitzgerald robfitzgerald merged commit 6799312 into main Mar 6, 2026
1 check passed
@robfitzgerald robfitzgerald deleted the rjf/preprocess-stop-matchnig branch March 6, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants