Real-time Trip Update data seems to be truncated


#1

Hi, guys.

I have been working with Real Time Trip Update data for 2 days.

What I have done is this:

I could successfully get response data in the format of zip file.

After extracting zip file, I could get tripupdate.txt.

Last week I could find the data of the Bus stop:
https://www.google.com/maps/place/Harris+St+Near+Pyrmont+Bridge+Rd/@-33.87102,151.194944,77m/data=!3m1!1e3!4m5!3m4!1s0x0:0xaa61d5ce9987ea53!8m2!3d-33.8710881!4d151.1947985?hl=en-US

Its stop id is 200916.
It has 2 route (389 and 501) and their route id is 2441_389 and 2441_389

By the way I cannot find anything of these route id this week.

Seems like response data is truncated.

I have seen that the last part of the file is like this:

Please help me!

I have attached the tripupdate.txt file I had downloaded.


#2

Hi,

If you look at the API documentation it states that the text format may be truncated. It’s a GTFS Realtime feed so you’ll need to consume the Protocol Buffers with more info available over at https://developers.google.com/protocol-buffers/.

Cheers,
Alistair


#3

Hi, phiali.
Thanks for your quick reply!

Yeah, I have forgotten to mention that I had used debug mode.

I tried to use protobuf with python, but finally failed to extract data.

Though I had followed their user guide exactly, I could not compile it.

Is there any .proto file for this data type?

Thanks again.

P.S. this is the proto file I had created.

syntax = "proto2";

package PKG_TripUpdate;


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

    message Entity {
	required string id = 1;
	message TripUpdate {
		message Trip {
			required string trip_id = 1;
			optional string start_time = 2;
			optional string start_date = 3;
			optional string schedule_relationship = 4;
			optional string route_id = 5;
		}
		required Trip trip = 1;
		
		message StopTimeUpdate {
			optional int32 stop_sequence = 1;
			
			message Arrival {
				optional int32 delay = 1;
				optional int32 time = 2;
			}
			optional Arrival arrival = 2;
			
			message Departure {
				optional int32 delay = 1;
				optional int32 time = 2;
			}
			optional Departure departure = 3;
			
			optional string stop_id = 4;
			
			optional string schedule_relationship = 5;
			
		}
		repeated StopTimeUpdate stop_time_update = 2;
		
		message Vehicle {
			optional string id = 1;
			optional string no_1999 = 2;
		}
		optional Vehicle vehicle = 3;
		
		optional int32 no_4 = 4;
		
	}
	required TripUpdate trip_update = 2;
	
    }
    repeated Entity entity = 2;
}

#4

Yeah the debug mode is useful but it’ll eventually become truncated so wouldn’t base any real work on that.

Did you try the version available from Google over at https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto? I’m sure I used that one, along with the PHP bindings (https://github.com/google/gtfs-realtime-bindings-php) and got it to work.


#5

Thanks for your advice, phiali.

Unfortunately, the python wrapper which is compiled from https://developers.google.com/transit/gtfs-realtime/gtfs-realtime-proto has failed to extract data.

But other python wrapper which is compiled from my .proto file above has succeeded to extract entity. But it has failed to extract inside the Entity (TripUpdate)

Seems like something is wrong in my .proto file.

Thanks. again.

Yuri.

P.S. This is updated .proto file.

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;
}

#6

hey guys there is actually a different proto file…

try this http://opendata.transport.nsw.gov.au/forum/t/illegal-value-error-when-decoding-sydneytrains-gtfs-data/149/5