Extensions
To facilitate the testing of new features and to allow developers to add extra information to a GTFS Realtime feed, we will take advantage of the Extensions feature of Protocol Buffers. Extensions allow us to define a namespace in a Protocol Buffer message where third-party developers can define additional fields without the need to modify the original proto definition.
When a developer is interested in extending the GTFS Realtime Specification, they should contact the GTFS Realtime mailing list and we will assign them the next available extension id, picked incrementally from a list of numbers starting at 1000 and going up and documented in the Extension Registry section found below.
These assigned extension ids corresponds to the tag ids available in the extension
namespace for each GTFS Realtime message definition. Now that the developer has an assigned extension id, they will use that id when extending any and all GTFS Realtime messages. Even if the developer only plans to extend a single message, the assigned extension id will be reserved for ALL messages.
For a developer extending the spec, instead of adding a single field like a string
or int32
with their extension id, the preferred model is to define a new message like MyTripDescriptorExtension
, extend the underlying GTFS Realtime message with your new message, and then put all your new fields in there. This has the nice property that you can manage fields within your extension message however you want, without needing to reserve a new extension id from the primary list.
message MyTripDescriptorExtension {
optional string some_string = 1;
optional bool some_bool = 2;
...
}
extend transit_realtime.TripDescriptor {
optional MyTripDescriptorExtension my_trip_descriptor = YOUR_EXTENSION_ID;
}
Extension Registry
Extension ID | Developer | Contact | Details |
---|---|---|---|
1000 | OneBusAway | onebusaway-developers | https://github.com/OneBusAway/onebusaway/wiki/GTFS-Realtime-Resources |
1001 | New York City MTA | mtadeveloperresources | http://mta.info/developers/ |
1002 | transit-realtime-partner-support@google.com | Google Maps Live Transit Updates | |
1003 | OVapi | gtfs-rt at ovapi.nl | http://gtfs.ovapi.nl |
1004 | Metra | William Ashbaugh w.l.ashbaugh@gmail.com | |
1005 | Metro-North Railroad | John Larsen | |
1006 | realCity | David Varga | http://realcity.io |
1007 | NSW TrainLink | Gregory Nicholls | Group discussion |
1008 | SEPTA - Southeastern Pennsylvania Transportation Authority | Gregory Apessos | https://github.com/septadev |
1009 | Swiftly | mike@goswift.ly | Group Discussion |
1010 | IBI Group | Ritesh Warade | GitHub proposal for new timestamps in Service Alerts |