OpendataCH / Transport

Swiss public transport API
http://transport.opendata.ch/
MIT License
241 stars 50 forks source link

Possibility of knowing the trip/journey ID or querying the trip object #184

Open ShiroYacha opened 6 years ago

ShiroYacha commented 6 years ago

Hi,

I am integrating GTFS-RT to retrieve real-time updates on delays for a given train. However, it seems to be quite complicated to identify a given trip based on the information provided by the "connections" resource. I wonder if there is a way to query the trip object or retrieve the internal trip_id in the sections of a connection?

By query the trip object I mean something similar to this screen in search.ch (by clicking on a train selected from a station and departing times): https://timetable.search.ch/trip/T2017_03127_000011_101_31e5359_0?time=16.42&date=11%2F06%2F2017&in=lausanne image

Actually, now I am identifying a trip with the transport number (e.g. IR 717) and the start time of the original station... Maybe there is a better way of doing this? It's also possible to query the static GTFS stop_times data but this requires a lot more optimizations...

Thanks

EDIT: actually I just found out that maybe with the transport number (e.g. IR 717) and the final destination (e.g. Zurich HB) I can identify a unique trip?

helbling commented 6 years ago

timetable.search.ch does currently not provide an API for a single trip. For single trips you can poll VDV directly: https://opentransportdata.swiss/en/dataset/fahrtprognose

Matching trips with hrdf ids with gtfsrt (using gtfs static ids) is quite a mess. I reactivated the gtfsrt integration on the timetable.search.ch API. See #181