GTFS Carriage Position#23
Open
gcamp wants to merge 14 commits into
Open
Conversation
Defines optimal carriage positioning for transfers and platform exits. Enables trip planners to recommend which carriage to board for minimal walking time at destinations. Fields: - from_stop_id: boarding platform - to_stop_id: destination stop/facility - recommended_carriage: 1-indexed from front - carriage_count: total positions (can be logical) - front_car_position: left/right platform side - facility_type: elevator/escalator/stairs (optional) Placed after pathways.txt as it complements station navigation.
Address PR review feedback by specifying stop_id references. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Spell out how trip planners translate a carriage_positions.txt recommendation when the departure and arrival platforms have opposite front_car_position values, so the off-by-one isn't left to consumers to re-derive. Claude-Session: https://claude.ai/code/session_014myjtAsSUXHGTssztGHLtD
- Use integer enums for front_car_position and facility_type; facility_type reuses the pathway_mode values instead of introducing a second numbering for stairs, escalator and elevator - Accept platforms with an empty location_type, as pathways.txt does, and spell out which location types are forbidden - Make station_directions.txt Conditionally Required when carriage_positions.txt is provided, since a recommendation cannot be interpreted without knowing platform orientation - State how route_id and direction_id records take priority over the default, and which record wins when several match a trip Claude-Session: https://claude.ai/code/session_014myjtAsSUXHGTssztGHLtD
Consumers combining a boarding recommendation with real-time per-carriage occupancy would otherwise have to translate between two numbering schemes for the same concept. Mirroring becomes carriage_count - recommended_carriage + 1. Claude-Session: https://claude.ai/code/session_014myjtAsSUXHGTssztGHLtD
Kept as a should so that connected platforms modeled as separate stations, such as transfers between operators, can still be described. Claude-Session: https://claude.ai/code/session_014myjtAsSUXHGTssztGHLtD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This proposal adds two new files,
station_directions.txtandcarriage_positions.txt, that let a feed express which carriage a rider should board to minimize walking at their destination.Describe the Problem
To speed up their trip, passengers want to know which carriage to board for a fast transfer or a fast exit at their destination.
pathways.txtcan give a rider turn-by-turn directions inside a station, yet nothing tells them where to stand on the platform before boarding. Agencies often have this information but GTFS has no way to encode it.Discussion started in google#614.
Proposed Solution
Two new files:
station_directions.txtdefines which side of the platform the front carriage stops at. One record per platform covers all trips, and optionalroute_idanddirection_idrecords take priority over that default so special configurations can be modeled, such as a platform on a bidirectional single-track section. Conditionally Required: required whencarriage_positions.txtis provided, since a recommendation cannot be interpreted without knowing platform orientation.carriage_positions.txtmaps an arrival platform, and optionally a specific transfer platform or station entrance/exit, to the recommended carriage to board. The optionalfacility_type, which reuses thepathways.txtpathway_modevalues for stairs, escalator and elevator, covers cases where the elevator serving a destination is several carriages away from the stairs serving the same destination, so riders needing step-free access can be sent to a different carriage.Recommendations are expressed relative to the front of the train at the arrival platform. When the departure platform is oriented the other way, planners mirror the carriage with
carriage_count - recommended_carriage + 1, so a single record stays usable regardless of which end of the train the rider boards from.recommended_carriageis numbered from1for the first carriage in the direction of travel, matching GTFS-realtimeCarriageDetails.carriage_sequence. Consumers that already show per-carriage occupancy from real-time data can then combine both without translating between two numbering schemes for the same concept, which would be a likely source of off-by-one errors.carriage_countis part of the primary key, which lets a platform carry different recommendations for trains of different lengths, and producers without exact carriage positions can use logical divisions instead:carriage_count=3withrecommended_carriage=1simply means "board near the front".Type of change
GTFS Schedule
Additional Information
This proposal is deliberately a small subset of what GTFS-VehicleBoardings attempted: it does not model platform sections or train formations, and instead encodes only the boarding recommendation itself.
PR #636 proposes
vehicles.txtalong with avehicle_classon routes.txt and trips.txt. This proposal does not depend on it and stays usable on its own throughcarriage_count, but if google#636 is adopted, an optionalvehicle_classincarriage_positions.txtwould be a natural follow-up to select the right configuration for a trip.Proposed Discussion Period
I recommend reserving one month for discussion, since this adds two new files and affects station modeling.
Testing Details
Proposal Update Tracker