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'}
...