Does anyone have .proto file for Real-Time public Transport Data?

Hi, guys.

I have been working with Real-Time Public Transport Data.

As you know, server responses the file in the format of Google’s Protocol Buffers.

To extract data, it is needed to de-serialize data, but after compiling, it fails to extract data.

This is my .proto file.

Does anyone have worked with this before?

syntax = "proto2";

package PKGTripTable;

message StopTimeEvent {
	optional int32 delay = 1;
	optional uint32 time = 2;
}

enum ScheduleRelationship {
  SCHEDULED = 0;
  SKIPPED = 1;
  NO_DATA = 2;
}

message TripDescriptor {
	optional string trip_id = 1;
	optional string start_time = 2;
	optional string start_date = 3;
    optional ScheduleRelationship schedule_relationship = 4;
	optional string route_id = 5;
}

message Vehicle {
	optional string id = 1;
	extensions 1000 to 1999;
}

message StopTimeUpdate {
	optional uint32 stop_sequence = 1;

	optional StopTimeEvent arrival = 2;

	optional StopTimeEvent departure = 3;

	optional string stop_id = 4;

	optional ScheduleRelationship schedule_relationship = 5;

}

message TripUpdate {

	optional TripDescriptor trip = 1;

	repeated StopTimeUpdate stop_time_update = 2;

	optional Vehicle vehicle = 3;

	extensions 1000 to 1999;

}

message Entity {
	optional string id = 1;

	optional TripUpdate trip_update = 2;

}

message Header {
	optional string gtfs_realtime_version = 1;
	optional string incrementality = 2;
	optional int32 timestamp = 3;
}

message TripTable{

    optional Header header = 1;

    repeated Entity entity = 2;
}

And this is the extracted data I have done so far:

'header':  {'gtfs_realtime_version': u'1.0', 'timestamp': 1475115721}
'entity':  {'id': u'33553_11128750_2436_619'}
'entity':  {'id': u'33553_11129065_2436_619_1'}
'entity':  {'id': u'33553_11129066_2436_619'}
'entity':  {'id': u'33553_11128943_2436_619'}
'entity':  {'id': u'33553_11128942_2436_619_1'}
'entity':  {'id': u'33553_11128698_2436_619_1'}
...

answered in the other thread

try this Illegal value Error when decoding SydneyTrains GTFS data - #5 by yvonne.lee - Real-time Public Transport - Open Data - Transport for NSW forum

1 Like

Many many thanks!!!

You saved my life!!!

Thanks again.

Hi

By the way I am wondering if I could get data for some bus-stop only, not for all data.

Is there any parameters I could put to get data of a route/bus-stop?

I am eager to hear from you soon.

(Thanks again…)

At the moment it’s all or nothing but @yvonne.lee will probably have some more info.

You will have seen a post previously where you can get it down to one bus contract region. Getting Timetable data of a bus stop - #3 by david.phillips - Real-time Public Transport - Open Data - Transport for NSW forum

That’s all we have for now. We are looking at building more APIs in future that provide a parameter / return such as what you are after. We can add it to our backlog.

For now, I know some of the other developers here have APIs provided from consuming the data and they may be able to provide the granularity you need.