Skip to content

GTFS Carriage Position#23

Open
gcamp wants to merge 14 commits into
masterfrom
feature/carriage-positions
Open

GTFS Carriage Position#23
gcamp wants to merge 14 commits into
masterfrom
feature/carriage-positions

Conversation

@gcamp

@gcamp gcamp commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

This proposal adds two new files, station_directions.txt and carriage_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.txt can 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.txt defines which side of the platform the front carriage stops at. One record per platform covers all trips, and optional route_id and direction_id records take priority over that default so special configurations can be modeled, such as a platform on a bidirectional single-track section. Conditionally Required: required when carriage_positions.txt is provided, since a recommendation cannot be interpreted without knowing platform orientation.
  • carriage_positions.txt maps an arrival platform, and optionally a specific transfer platform or station entrance/exit, to the recommended carriage to board. The optional facility_type, which reuses the pathways.txt pathway_mode values 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_carriage is numbered from 1 for the first carriage in the direction of travel, matching GTFS-realtime CarriageDetails.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_count is 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=3 with recommended_carriage=1 simply means "board near the front".

Type of change

GTFS Schedule

  • Functional Change

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.txt along with a vehicle_class on routes.txt and trips.txt. This proposal does not depend on it and stays usable on its own through carriage_count, but if google#636 is adopted, an optional vehicle_class in carriage_positions.txt would 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

  • Consumer(s): Transit
  • Producer(s): TBD (please mention if you want to produce!)
  • Estimated Testing Period: TBD

Proposal Update Tracker

Date Update Description
xxx Initial PR submission

gcamp and others added 14 commits February 4, 2026 15:52
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
@gcamp gcamp changed the title GTFS Carriage Positioning GTFS Carriage Position Jul 25, 2026
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