Unable to get Vehicle Descriptor for buses.


I am unable to access the vehicle descriptor fields for buses. When I did my initial search on this issue, I came across this post which describes a method for getting the vehicle descriptor information. I followed that method, however, the output still doesn’t provide me with the descriptor information that is available.

For my .proto file I used this one from the OpenData website. The steps I followed to compile that file is the following command:

protoc tfnsw-gtfs-realtime.proto --python_out=./

which generated me a python file that I imported into my script. A barebones version of my script is below:

import requests
import tfnsw_gtfs_realtime_pb2
import google.protobuf 
from print import pprint
# REDACTED : Authorization header definition
testing = requests.get('https://api.transport.nsw.gov.au/v1/gtfs/vehiclepos/buses', headers=headers)

busfeed = tfnsw_gtfs_realtime_pb2.FeedMessage()

for entity in busfeed.entity[:5]:

In theory, this should return all of the expected fields, alongside the vehicle descriptor fields, however, for the vehicle part, I only get the following:

vehicle {
    id: "whatever id for the entry"

Does anyone know how I would be able to get the remaining vehicle descriptor fields (air_conditioned, wheelchair_accessible, vehicle_model)?

Many thanks in advance,

Hi @jacktech, the proto file you linked to appears to have the old tfnsw vehicle descriptor extension of 1999. The buses feed now uses extension 1007. Our current proto files in use are available here: https://opendata.transport.nsw.gov.au/documentation#1


I updated my local files and was able to get the vehicle descriptor fields. Thanks, David!

1 Like
© Transport for NSW