How do I use GTFS-RT

34 views
Skip to first unread message

Michael Tsang

unread,
May 10, 2024, 7:51:12 AMMay 10
to OpenTripPlanner Users
Hi all,

I am trying to connect the GTFS-RT feed from Bus Open Data Service but it doesn't work.

It says:

May 10 12:46:07 johnson java[2883983]: 12:46:07.105 WARN [updater-0]  (GtfsRealtimeHttpVehiclePositionSource.java:46) Error reading vehicle positions from https://data.bus-data.dft.gov.uk/avl/download/gtfsrt
May 10 12:46:07 johnson java[2883983]: org.opentripplanner.framework.io.OtpHttpClientException: com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).

The updater is:
{
  "type": "vehicle-positions",
  "url": "https://data.bus-data.dft.gov.uk/avl/download/gtfsrt",
  "feedId": "DfT",
  "frequency": "PT10S"
}

Thanks,
Michael

Bodo Minea

unread,
May 14, 2024, 11:34:06 AMMay 14
to Michael Tsang, OpenTripPlanner Users
I took a peak at this issue and it looks like the URL you have provided -  https://data.bus-data.dft.gov.uk/avl/download/gtfsrt does something a bit weird.

If we look at the HTTP headers it looks like the data is in the zip (the archive) file format:
image.png

It actually serves you a zip file containing the latest data for these vehicles. This is not standard and you will not be able to use the data directly in any GTFS-Realtime consuming application. It's something that they're likely doing to conserve bandwidth. Apps expect static data to be zipped, but not realtime data. You can see an example of me decoding the data successfully below:

image.png

To use this in a continuous manner (eg. pulling data at an interval from the server), you will need to write an intermediary app and deploy it as a server (eg. that accesses the link, gets the data, unzips it and serves the actual binary for use in final consumer apps).

Also please note that this is a vehicle positions only feed, it contains no delay or stop time update information, either at trip or stop sequence level. This means opentripplanner would ingest it but not update planning results based on it. You either need to also get access to a tripUpdates feed or explore generating the tripUpdates yourself (using software like TheTransitClock - https://github.com/TheTransitClock/transitime for example).

I hope this gets you further to your goal.

Best regards,
Bogdan.

--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/opentripplanner-users/7a1c459b-a5f4-404c-a41e-b1ae70954e7dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages