Getting GTFS-realtime for buses up and running


#1

Hi all,

Hoping someone can help. I’ve downloaded and processed the GTFS file located here:
https://opendata.transport.nsw.gov.au/direct/full_greater_sydney_gtfs_static.zip

OK, that’s all good. I’ve also set up a GTFS-realtime parser that collects the realtime feed from here:
https://api.transport.nsw.gov.au/v1/gtfs/realtime/buses

Again, all good. Now I see that the Trip IDs used in the GTFS-realtime feed aren’t present in the GTFS trips.txt file. I see from another topic in this forum that there’s another GTFS feed (exclusively for buses) which DOES have the correct Trip IDs.

So if I’m looking to have a system that includes real-time for all transport modes, what do I need to do to make this work?

Are there separate GTFS feeds for each transport mode (buses, trains, ferries etc.) that I can use, and each GTFS Trip ID will match the GTFS-realtime Trip ID?

Or do I need to process the ‘full’ GTFS feed first, then remove any and all bus information (stops, trips, routes, shapes, stop times, calendars), then process the ‘buses’ GTFS feed, in order to have GTFS trips that match their GTFS-realtime counterparts?

Many thanks in advance.


#2

Hi @markerpen, yes, there are seaparate GTFS feeds for each mode of transport. You will have to match the data using Trip IDs.

Thanks,
Alex


#3

Hi @alejandro.felman,

Many thanks for the reply. Where can I find GTFS files separated by transport mode? At the moment I can only find three separate bundles:

  1. The GTFS file that contains all modes (but bus trips don’t use the correct Trip IDs)
  2. The ‘bus’ GTFS file that has the correct Trip IDs (all operators in one GTFS file)
  3. Separate GTFS files for each bus operator

Any help would be greatly appreciated.


#4

I found the separate GTFS feeds in the API Explorer - unfortunately I keep hitting 401 errors. Whether using the API key as a query string like below or using an Authorisation header. I’ve made sure my API key is valid for ‘GTFS for realtime’ but that makes no difference.

https://api.transport.nsw.gov.au/v1/gtfs/schedule/buses?apikey=[API KEY]

or

https://api.transport.nsw.gov.au/v1/gtfs/schedule/buses
Authorization: apikey [API KEY]

Anybody facing the same issue?


#5

The latter authentication method with the Authorization header should work.

Note that for buses, the GTFS bundles are separated by agencies. See the full list here http://opendata.transport.nsw.gov.au/forum/t/gtfs-bundle-for-type-schedule-is-not-available-for-agency-buses/65/18?u=jxeeno


#6

Hi @markerpen, as @jxeeno said, the second method you mentioned should work. Please use the following parameters:

Authentication Type: API Key
API Key: apikey XXXXXXXXXXXXXXX
API Key Parameter Name: authorization
API Key Type: Header

Let me know if you encounter further issues.

Thanks,
Alex