I’m pretty new to TfNSW data. I could download and decode the Bus Position Feed Message using python gtfs_realtime_pb2 library.
However, the decoded feed doesn’t contain TfNSW vehicle descriptor e.g. air_conditioned, vehicle_model. This should be included according to Realtime Bus Technical Documentation.
message TfnswVehicleDescriptor {
// The TfnswVehicleDescriptor extends the GTFS vehicle message to provide additional vehicle attribute information to the consuming application
optional bool air_conditioned = 1 [default = false];
// Indicates the availability of air-conditioning on this vehicle
optional int32 wheelchair_accessible = 2 [default = 0];
// Indicates the number of wheel chairs that can be accommodated on this vehicle
optional string vehicle_model = 3;
// A the type of vehicle performing this trip
optional bool performing_prior_trip = 4 [default = false];
// An indicator used to display the location of vehicles that will execute this upon completion of their current trip
optional int32 special_vehicle_attributes = 5 [default = 0];
// Used to pass ad-hoc temporary additional vehicle attribute information, for example Christmas buses
}
extend transit_realtime.VehicleDescriptor {
optional TfnswVehicleDescriptor tfnsw_vehicle_descriptor = 1999;
// Assumes the TfNSW extension number will be 1999
}
As @yvonne.lee said, the TfnswVehicleDescriptor entity is an extension of the GTFS-realtime standard. You’ll need to compile your own protocol buffer bindings for Python if you want to read it. Google has some docs on this which may help.
Thanks @jxeeno, @yvonne.lee. I successfully compiled the protocol buffer from the .proto file you’ve given. And it can be used to grab the vehicle descriptor feed message
I have removed a few lines from the .proto file for this to work though. Here are what I have removed in case someone is having the same issue and in case someone can give a clarification on this:
Remove this because they are duplicated which will give error ‘Multiple package definitions.’
I’m not sure where to find au_nsw_sydney.proto and python class couldn’t be compiled because the file cant be found. So I remove this line and it works: