How to get previous stop from GTFS-realtime?

102 views
Skip to first unread message

Arjun Shanmugam

unread,
Jul 30, 2023, 12:48:46 AM7/30/23
to GTFS-realtime
Hi all,

I was wondering what the best way to get a vehicle's previous stop would be using GTFS-realtime. From GTFS-realtime, it is easy to identify what station a vehicle is approaching, but I need to know the origin station as well.

Thanks so much!

Joachim Pfeiffer

unread,
Jul 30, 2023, 10:43:30 AM7/30/23
to gtfs-r...@googlegroups.com
 Using stop_id and trip_id, you can look that up in stop_times.txt of the static GTFS feed that corresponds with the RT feed.

--
You received this message because you are subscribed to the Google Groups "GTFS-realtime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtfs-realtim...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gtfs-realtime/59a34655-05fa-4db5-ad63-2ef3ffab0418n%40googlegroups.com.

Arjun Shanmugam

unread,
Jul 30, 2023, 10:45:17 AM7/30/23
to GTFS-realtime
Thank you so much for the help! One thing that I am a little unsure about here is that it seems that not all of the trip IDs from the GTFS realtime feed are present in stop_times.txt. For instance, some of the trip ids begin with "ADDED". Do you know why this might be the case? Shouldn't every trip ID in GTFS realtime be present in stop_times.txt?

Joachim Pfeiffer

unread,
Jul 30, 2023, 11:32:07 AM7/30/23
to gtfs-r...@googlegroups.com
Things vary from operator to operator, e.g. whether frequencies.txt is used. You'll have to see what you can piece together from static GTFS and GTFS-rt.
As far as the case you describe is concerned - depending on how they work, bus dispatch/train control might add a trip by copy/pasting from an existing origin trip, and setting the stop times of the new trip from a start time they provide for the new trip. There is a chance you can look up the origin trip from the new trip's trip_id following the "ADDED_" prefix. With that, you have the reference data for generating the new trip's stop sequence as well as the stop times.
JP

Reply all
Reply to author
Forward
0 new messages