Skip to content

GTFS Carriage Position - #650

Open
gcamp wants to merge 3 commits into
google:masterfrom
TransitApp:feature/carriage-positions
Open

GTFS Carriage Position#650
gcamp wants to merge 3 commits into
google:masterfrom
TransitApp:feature/carriage-positions

Conversation

@gcamp

@gcamp gcamp commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

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 #614. Thanks @vikiawv @jfabi for the comments and suggestions!

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".

Here is an example of a dataset I made from the Paris GTFS and the open data carriage position CSV they have.

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 #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
July 29 2026 Initial PR submission

carriage_positions.txt lets producers recommend which carriage a rider
should board to minimize walking at their destination, either when
transferring to another platform or when leaving the station. Pathways
describe navigation once a rider is off the train, but nothing said where
to stand on the platform before boarding.

Recommendations are relative to the front of the train at the arrival
platform while riders board at the departure platform, so
station_directions.txt records which side of each platform the front
carriage stops at and the mirroring formula trip planners apply when the
two platforms disagree.
@etienne0101 etienne0101 added GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule Discussion Period The community engages in conversations to help refine and develop the proposal. Change type: Functional Refers to modifications that significantly affect specification functionalities. labels Jul 29, 2026
@skalexch

skalexch commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

@gcamp thank you for raising this proposal. Best carriage information is an important addition to the spec.
I have a few remarks/questions:

  1. front_car_position should probably be renamed to front_carriage_position, a less regional term and more consistent with the file name.
  2. front_car_position does not need to be specified for both the departure and arrival platforms in order to make a recommendation. If someone is going to alight at a platform, they should still be able to get a recommendation for where to board initially, using only the front carriage position at the arrival platform.
  3. The primary key for carriage_positions.txt could be extended or made to be the entire row. Sometimes more than one carriage could be "best". For example, a pathway in the middle of the platform can be best accessed via carriages 4 and 5 on an 8-carriage train.
  4. In the proposal, to_stop_id can only reference a stop/platform or an entrance/exit, generic nodes are not allowed. Generic nodes aren’t necessarily a bad thing: if the producer links all platforms to generic nodes, those pathways could be used to chain together a best-carriage recommendation (I.e. getting the best carriage that leads to the generic node which leads to the exit).
  5. I conceptually like the fact that recommended_carriage and carriage_count could be logical enums (e.g. carriage_count=3 to denote front, middle and back). However, if a consumer uses them literally they might end up recommending carriage_nb=2 while the rider is meant to take the middle carriage. There should be consistency there between what a producer and a consumer interpret. Better to introduce a separate field for categorical boarding positions.

@gcamp

gcamp commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

@skalexch thank you for the comments!

  1. front_car_position should probably be renamed to front_carriage_position

👍

  1. front_car_position does not need to be specified for both the departure and arrival platforms in order to make a recommendation.

Can you explain me a bit more because I don't see how we can do without. The recommendation of where you board on the origin will matter if the train front carriage is left or right on that station. See this line Edit : Never mind, I though a bit more about and you're right! Did the edit

  1. The primary key for carriage_positions.txt could be extended or made to be the entire row. Sometimes more than one carriage could be "best". For example, a pathway in the middle of the platform can be best accessed via carriages 4 and 5 on an 8-carriage train.

👍

  1. In the proposal, to_stop_id can only reference a stop/platform or an entrance/exit, generic nodes are not allowed. Generic nodes aren’t necessarily a bad thing

I'm mixed on that one. I don't want to complexify the implementation too much, but I see the benefits. I'm going to change but if others think it's too much let me know.

  1. Better to introduce a separate field for categorical boarding positions.

I guess my counter question is why would a consumer care about if the num carriage is true or not in the context of boarding location? If we added a field I'm not sure how we would use it (re guiding principles of speculative features)

gcamp added 2 commits August 12, 2026 09:23
Review feedback on google#650.

front_car_position becomes front_carriage_position, matching the
"carriage" wording used everywhere else in both files.

carriage_positions.txt takes the whole row as its primary key. More than
one carriage can be equally good for the same destination — a platform
with stairs at both ends leading to the same transfer platform is served
just as well by the first or the last carriage — and the old key
(stop_id, to_stop_id, via_pathway_mode, carriage_count) left room for
only one of them.

to_stop_id also accepts generic nodes and boarding areas now; only
stations stay forbidden. A junction riders continue through, or a
specific boarding area on a transfer platform, are both legitimate
destinations for a recommendation, and forbidding them forced producers
to point at a coarser location instead. The same-station sentence drops
its stops.parent_station reference, which does not hold for boarding
areas: their parent is a platform, not a station.
Review feedback on google#650, point 2.

recommended_carriage counts carriages from the front of the train, the
same frame as GTFS-realtime CarriageDetails.carriage_sequence, so the
index does not change along a trip. Mirroring it when the two platforms
disagree converts it a second time and sends riders to the opposite end
of the train: a recommendation of carriage 1, authored because the exit
stairs are at the nose of the train, became carriage 8 whenever the
boarding platform's front_carriage_position differed, which is routine
for platform pairs that merely differ in track layout.

Consumers need front_carriage_position for the boarding platform only,
and they need it to render the recommendation at all: a bare carriage
index is not something a rider can act on, so the paragraph now shows
how the index becomes an end of the platform the rider is standing on.

The one case where the front of the train genuinely changes mid-trip is
a physical reversal, which front_carriage_position cannot express since
it describes platform geometry rather than train orientation.
@skalexch

Copy link
Copy Markdown
Collaborator

@gcamp thanks for the changes! For the two remaining questions:
4) +1, it will complexify but it's better to not prohibit the usage of generic nodes altogether because they can exist in a station's pathways graph and their use case could be valid. Prohibiting them now will open a versioning or spec correction discussion in the future if someone supporting generic nodes decides to implement best carriage info.

  1. I'm not sure if I understood your question. The issue I see arises from this case:
    Assume a consumer displays this phrase "Take carriage {recommended_carriage} out of {carriage_count} from your right to exit easily".
    The consumer gets a GTFS feed with recommended_carriage=2 and carriage_count=3. The producer's implication is to take the MIDDLE (2) carriage out of [FRONT (1), MIDDLE (2), BACK (3)].
    In this case, the consumer will show "Take carriage 2 out of 3 from your right to exit easily". Because the consumer does not know that 3 is not the actual number of carriages, but a logical position enum. If the train in question has 8 carriages, that message might confuse the rider.

As it currently stands, the proposal works 100% clearly and correctly only if the consumer shows a graphic of the relative position of the rider after doing the calculation recommended_carriage/carriage_count. If the consumer wants to be specific on which exact carriage the rider should ride, then carriage_count has to always equate the real carriage count.

I like both concepts of being able to show either the actual carriage or a relative position [FRONT, MIDDLE, BACK]. But I think both of them being modelled using the same fields might cause misinterpretation.

@gcamp

gcamp commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

If the consumer wants to be specific on which exact carriage the rider should ride

My point is that is not something we want to do. I'm not against this use case, but it's a speculative feature unless somebody else ask. What we could do is rename the field and state that it's only a virtual representation of the carriage length, and keep the door open for an other field in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Change type: Functional Refers to modifications that significantly affect specification functionalities. Discussion Period The community engages in conversations to help refine and develop the proposal. GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants