3

I have experience using the static GTFS files which define the operating model for a specific public transport network. However my city has just release a real time feed for the bus locations and other status updates for the network.

My question is, how should I view this feed in real time and record the feed into a database. The link to the real time feed is as follows: https://gtfsrt.api.translink.com.au/

Tom
  • 925
  • 3
  • 10
  • 24

3 Answers3

1

The GTFS-realtime spec now includes code samples for parsing GTFS-realtime data in a variety of languages:

https://developers.google.com/transit/gtfs-realtime/code-samples

It's a good place to start when it comes to parsing GTFS-realtime data in your favorite language.

Brian Ferris
  • 7,557
  • 5
  • 25
  • 27
0

I needed to install google's protocol buffer, then compile the gifts-realtime.proto with the protocol buffer to generate code which can then read the API source.

Tom
  • 925
  • 3
  • 10
  • 24
0

Install Nugget Package Google.Protobuf

PM> Install-Package Google.Protobuf -Version 3.4.1

private FeedMessage _feedMessage;
using (MemoryStream protobufMemoryStream = new MemoryStream())
using (Stream protobufStream = await _httpClient.GetStreamAsync("", "http://gtfs.ovapi.nl/new/vehiclePositions.pb")) 
{
    protobufStream.CopyTo(protobufMemoryStream);
    protobufMemoryStream.Position = 0;
    _feedMessage = Serializer.Deserialize<FeedMessage>(protobufMemoryStream);
}

In _feedMessage you have deserialize GTFS RealTime Model to persist data into database.