GTFS-RT non-unique trip IDs for 7 train

99 views
Skip to first unread message

Chris West

unread,
Sep 29, 2026, 9:00:07 AMSep 29
to mtadeveloperresources
Hi all,

I've noticed that there are distinct 7 train trips that are being assigned the same trip ID (and start date) in the realtime data. Is anyone familiar with this issue? I've attached a feed that shows the problem (see trip ID "1035507..S").

Thanks!
numeric_20260925211302.json

Raphael Sanzio

unread,
Oct 6, 2026, 9:24:04 AMOct 6
to mtadeveloperresources
Chris:  I've been doing some work focused on the 7 line and looking at the real time feed for that line very closely.  It is part of a project to make a live map of the 7 line showing activity along the line in a way that is more detailed than most of what you see out there.  We draw a separate line for each track (1, M and 2) and try to show the movement of each train along the different track.  they current construction has us looking at patterns very closely to try to make the real time data as useful as possible.   I am also trying to infer put-ins and lay-ups to/from the Corona Yard and the tails that run out south of Hudson Yards terminal.  These non-passenger movements are not directly covered by the real-time feed, so we have been doing a lot of work with the static schedule and the real time feed to interpret patterns. 

Regarding the trip ID issue you point out, we see the same thing in our log of the 7, and have noticed that it follows a pattern. The NYCT trip_id is the scheduled origin time (hundredths of a minute after midnight) plus route and direction, so 103550_7..S is a Manhattan-bound 7 leaving at 5:15:30 PM. It does not include the origin terminal or destination terminal, so two trips leaving different terminals in the same half-minute in the same direction get the same trip_id. On the 7 that happens every weekday, because trips start at 111 St and Mets-Willets Point as well as Flushing-Main St, and Flushing-bound trips from 34 St-Hudson Yards end at 111 St, Willets Point or Main St.

We have found that it is possible to tell the trips apart by NyctTripDescriptor.train_id, whose origin and destination codes differ (MST, 111, WPT, 34H).  Pair each VehiclePosition with its TripUpdate by entity id rather than trip_id (we've noticed that the real time feed writes a train's two entities one after the other, so if the TripUpdate's id is 000332, the VehiclePosition's is 000333); and when matching to the static GTFS, choose the static trip whose first stop matches the train ID's origin.

Your example is two trips in the 5:15:30 PM slot: train IDs 07 1715+ 111/34H (from 111 St) and 07 1715+ MST/34H (from Flushing-Main St). We see that pair on every weekday we have logged (e.g. 29 and 30 September, 1 and 5 October). If the file name of your attachment is based on UTC, 21:13:02 is 5:13 PM in New York, two minutes before both leave.  So I suspect we are looking at the same data from September 29.

From 26 September to 5 October we counted 171 trip IDs shared by two trains at the same moment, on 8 service days. The commonest pairs, by the train ID's origin/destination codes: 111/34H with MST/34H (afternoon starts at 111 St and Main St): 50; 34H/111 with 34H/WPT: 41; and 34H/111 with 34H/MST: 40 (morning trips from Hudson Yards); MST/34H with WPT/34H: 21.

I hope this helps.

Underway

unread,
Oct 6, 2026, 11:14:22 AMOct 6
to mtadevelop...@googlegroups.com
I’ve noticed the same thing too. It’s blocking some cool features in my app. 


Daniel
Underway





--
You received this message because you are subscribed to the Google Groups "mtadeveloperresources" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mtadeveloperreso...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mtadeveloperresources/882bbb9e-477c-49d8-9f9b-9a0f69b450c0n%40googlegroups.com.

Chris West

unread,
Oct 7, 2026, 11:31:15 AMOct 7
to mtadeveloperresources
Raphael: thanks for the detailed response! This is very helpful information and I expect I'll be able to correctly distinguish trips with the method you've described. It's too bad that cross-referencing with the static feeds are needed to accomplish this. Also, I'd be very curious to see the project you're working on!

I noticed the issue on the manhattan bound L this morning too.

FWIW, non-unique trip-ids are in violation of the GTFS contract: https://gtfs.org/documentation/realtime/reference/#message-tripdescriptor

> The trip_id field cannot, by itself or in combination with other TripDescriptor fields, be used to identify multiple trip instances.

Raphael Sanzio

unread,
Oct 13, 2026, 11:18:19 AMOct 13
to mtadeveloperresources
I am very glad you found it useful.  I will post more about my project in the future. 
Reply all
Reply to author
Forward
0 new messages