Skip to content

Port MOTIS-style platform matching through Gentian, Edelweiss and OSR FFI - #145

Merged
kylerchin merged 24 commits into
mainfrom
fix/edelweiss-platform-aware-station-access-20261030
Oct 31, 2026
Merged

kylerchin merged 24 commits into
mainfrom
fix/edelweiss-platform-aware-station-access-20261030

Conversation

@kylerchin

@kylerchin kylerchin commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Scope: MOTIS-style platform matching parity across Gentian and Edelweiss

The regression is an origin immediately adjacent to Expo/Sepulveda that nevertheless fails to walk to Metro E Line unless the origin is moved onto the raw GTFS stop coordinate. Previously the backend matched every stop as an unspecified-level outdoor coordinate and the OSR extraction omitted native platform metadata.

Changes committed

  • osm_manager: extract native OSM platforms with -p; existing OSR extraction fingerprints trigger graph refresh when extractor changes. Graphs generated without platform files remain readable.
  • Native dependency: pin osr-ffi #15, with matching of named OSM nodes, ways, and geometry-bearing platform relation members, MOTIS-style scoring using GTFS stop ID/name/number, platform code, public route labels, way geometry and level, and validation of the pedestrian graph on non-ground levels.
  • Gentian: use the matched platform level for each stop while building both forward and reverse native OSR match stores before directed transfer computation.
  • Compiler: query gtfs.stops.platform_code and gtfs.stops.routes, map route IDs to gtfs.routes.short_name, and emit a per-region, stop-index-aligned .platforms.json sidecar instead of breaking the mmap timetable v5 binary format.
  • Router manager: load the sidecar and validate stop count at timetable startup; older deployments without the sidecar retain empty hints.
  • Edelweiss: pass GTFS stop ID/name, platform code and public route labels to the OSR worker for both first-mile and last-mile one-to-many searches.
  • Worker: preserve directional matching and profile-specific speed semantics while selecting matched destination stop levels, including backward egress.

Outstanding parity boundaries

This is a source-based port, not verified binary equivalence. MOTIS also has precomputed per-stop platform indexes and reusable raw-way match columns, while this branch resolves OSM platform levels during matching; native source geometry and match scores should be compared on a real graph. Empty-geometry OSM relations have no routable geometry and are not matched. Station-entrance links missing entirely from OSM cannot be manufactured by matching.

Critical verification before merge

  1. Build both repos (GCC 14+ and Rust); validate CXX symbols and that route lookups compile.
  2. Extract SoCal OSM data with -p; rebuild Gentian timetable and sidecar together.
  3. Verify Expo/Sepulveda walk access with origin offset 0, 10, 30, 75, 150m on both sides, using same departure and local transit timetable as MOTIS. Assert candidate station offsets, duration, boardability, direction, and walking geometry.
  4. Compare before/after cross-platform and underground stations for incorrect elevated-ground connections.
  5. Measure route performance including platform index build on worker startup, stop matching throughput for 4096 candidates, and sidecar loading.
  6. Verify sidecar schema from actual PostgreSQL imports and test both direct departure and arrive-by reverse search.

This remains a draft until native compilation, integration testing, and a side-by-side MOTIS run are completed.

CI repair: pinned OSR FFI and worker integration

The initial backend CI log compiled osr-ffi at e6261e7, which still contained the mixed bool / double auto deduction in router.cc:408. The fix landed in OSR FFI PR #17, whose native CI passed. This branch now pins the immutable merged commit fe06b16f6ed1f66dc2f5a0038b38d0097b328161.

Additional fixes included on the backend branch:

  • Gentian footpaths::compute now declares the timetable stop slice before validating its size.
  • osr_worker keeps the match_platform metadata-aware path for both forward access and backward egress. Its unit test initializes the full request structure, and its bounded request reader accepts up to 4 MiB to accommodate 4096 annotated stops.
  • osm_manager now validates native platform index files and tracks with_platforms in the manifest so an older graph lacking -p metadata cannot be accidentally treated as current.
  • Fixed invalid indentation in .github/workflows/rust-clippy.yml, previously causing the Clippy workflow to fail before a job started.

Backend CI was running when these changes were committed; successful full-backend compilation and SoCal walking-access parity are not yet established. Keep this PR in draft until native and Rust jobs complete.

@kylerchin kylerchin changed the title Fix Edelweiss first/last-mile station matching with OSM platform levels Port MOTIS-style platform matching through Gentian, Edelweiss and OSR FFI Oct 31, 2026
@kylerchin
kylerchin marked this pull request as ready for review October 31, 2026 06:32
@kylerchin
kylerchin merged commit 316490c into main Oct 31, 2026
3 of 6 checks passed
@kylerchin
kylerchin deleted the fix/edelweiss-platform-aware-station-access-20261030 branch November 8, 2026 19:59
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.

1 participant