gtfs-realtime.proto 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. // Copyright 2015 The GTFS Specifications Authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Protocol definition file for GTFS Realtime.
  15. //
  16. // GTFS Realtime lets transit agencies provide consumers with realtime
  17. // information about disruptions to their service (stations closed, lines not
  18. // operating, important delays etc), location of their vehicles and expected
  19. // arrival times.
  20. //
  21. // This protocol is published at:
  22. // https://github.com/google/transit/tree/master/gtfs-realtime
  23. syntax = "proto2";
  24. option java_package = "com.google.transit.realtime";
  25. package transit_realtime;
  26. // The contents of a feed message.
  27. // A feed is a continuous stream of feed messages. Each message in the stream is
  28. // obtained as a response to an appropriate HTTP GET request.
  29. // A realtime feed is always defined with relation to an existing GTFS feed.
  30. // All the entity ids are resolved with respect to the GTFS feed.
  31. // Note that "required" and "optional" as stated in this file refer to Protocol
  32. // Buffer cardinality, not semantic cardinality. See reference.md at
  33. // https://github.com/google/transit/tree/master/gtfs-realtime for field
  34. // semantic cardinality.
  35. message FeedMessage {
  36. // Metadata about this feed and feed message.
  37. required FeedHeader header = 1;
  38. // Contents of the feed.
  39. repeated FeedEntity entity = 2;
  40. // The extensions namespace allows 3rd-party developers to extend the
  41. // GTFS Realtime specification in order to add and evaluate new features and
  42. // modifications to the spec.
  43. extensions 1000 to 1999;
  44. // The following extension IDs are reserved for private use by any organization.
  45. extensions 9000 to 9999;
  46. }
  47. // Metadata about a feed, included in feed messages.
  48. message FeedHeader {
  49. // Version of the feed specification.
  50. // The current version is 2.0. Valid versions are "2.0", "1.0".
  51. required string gtfs_realtime_version = 1;
  52. // Determines whether the current fetch is incremental. Currently,
  53. // DIFFERENTIAL mode is unsupported and behavior is unspecified for feeds
  54. // that use this mode. There are discussions on the GTFS Realtime mailing
  55. // list around fully specifying the behavior of DIFFERENTIAL mode and the
  56. // documentation will be updated when those discussions are finalized.
  57. enum Incrementality {
  58. FULL_DATASET = 0;
  59. DIFFERENTIAL = 1;
  60. }
  61. optional Incrementality incrementality = 2 [default = FULL_DATASET];
  62. // This timestamp identifies the moment when the content of this feed has been
  63. // created (in server time). In POSIX time (i.e., number of seconds since
  64. // January 1st 1970 00:00:00 UTC).
  65. optional uint64 timestamp = 3;
  66. // The extensions namespace allows 3rd-party developers to extend the
  67. // GTFS Realtime specification in order to add and evaluate new features and
  68. // modifications to the spec.
  69. extensions 1000 to 1999;
  70. // The following extension IDs are reserved for private use by any organization.
  71. extensions 9000 to 9999;
  72. }
  73. // A definition (or update) of an entity in the transit feed.
  74. message FeedEntity {
  75. // The ids are used only to provide incrementality support. The id should be
  76. // unique within a FeedMessage. Consequent FeedMessages may contain
  77. // FeedEntities with the same id. In case of a DIFFERENTIAL update the new
  78. // FeedEntity with some id will replace the old FeedEntity with the same id
  79. // (or delete it - see is_deleted below).
  80. // The actual GTFS entities (e.g. stations, routes, trips) referenced by the
  81. // feed must be specified by explicit selectors (see EntitySelector below for
  82. // more info).
  83. required string id = 1;
  84. // Whether this entity is to be deleted. Relevant only for incremental
  85. // fetches.
  86. optional bool is_deleted = 2 [default = false];
  87. // Data about the entity itself. Exactly one of the following fields must be
  88. // present (unless the entity is being deleted).
  89. optional TripUpdate trip_update = 3;
  90. optional VehiclePosition vehicle = 4;
  91. optional Alert alert = 5;
  92. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  93. optional Shape shape = 6;
  94. // The extensions namespace allows 3rd-party developers to extend the
  95. // GTFS Realtime Specification in order to add and evaluate new features and
  96. // modifications to the spec.
  97. extensions 1000 to 1999;
  98. // The following extension IDs are reserved for private use by any organization.
  99. extensions 9000 to 9999;
  100. }
  101. //
  102. // Entities used in the feed.
  103. //
  104. // Realtime update of the progress of a vehicle along a trip.
  105. // Depending on the value of ScheduleRelationship, a TripUpdate can specify:
  106. // - A trip that proceeds along the schedule.
  107. // - A trip that proceeds along a route but has no fixed schedule.
  108. // - A trip that have been added or removed with regard to schedule.
  109. //
  110. // The updates can be for future, predicted arrival/departure events, or for
  111. // past events that already occurred.
  112. // Normally, updates should get more precise and more certain (see
  113. // uncertainty below) as the events gets closer to current time.
  114. // Even if that is not possible, the information for past events should be
  115. // precise and certain. In particular, if an update points to time in the past
  116. // but its update's uncertainty is not 0, the client should conclude that the
  117. // update is a (wrong) prediction and that the trip has not completed yet.
  118. //
  119. // Note that the update can describe a trip that is already completed.
  120. // To this end, it is enough to provide an update for the last stop of the trip.
  121. // If the time of that is in the past, the client will conclude from that that
  122. // the whole trip is in the past (it is possible, although inconsequential, to
  123. // also provide updates for preceding stops).
  124. // This option is most relevant for a trip that has completed ahead of schedule,
  125. // but according to the schedule, the trip is still proceeding at the current
  126. // time. Removing the updates for this trip could make the client assume
  127. // that the trip is still proceeding.
  128. // Note that the feed provider is allowed, but not required, to purge past
  129. // updates - this is one case where this would be practically useful.
  130. message TripUpdate {
  131. // The Trip that this message applies to. There can be at most one
  132. // TripUpdate entity for each actual trip instance.
  133. // If there is none, that means there is no prediction information available.
  134. // It does *not* mean that the trip is progressing according to schedule.
  135. required TripDescriptor trip = 1;
  136. // Additional information on the vehicle that is serving this trip.
  137. optional VehicleDescriptor vehicle = 3;
  138. // Timing information for a single predicted event (either arrival or
  139. // departure).
  140. // Timing consists of delay and/or estimated time, and uncertainty.
  141. // - delay should be used when the prediction is given relative to some
  142. // existing schedule in GTFS.
  143. // - time should be given whether there is a predicted schedule or not. If
  144. // both time and delay are specified, time will take precedence
  145. // (although normally, time, if given for a scheduled trip, should be
  146. // equal to scheduled time in GTFS + delay).
  147. //
  148. // Uncertainty applies equally to both time and delay.
  149. // The uncertainty roughly specifies the expected error in true delay (but
  150. // note, we don't yet define its precise statistical meaning). It's possible
  151. // for the uncertainty to be 0, for example for trains that are driven under
  152. // computer timing control.
  153. message StopTimeEvent {
  154. // Delay (in seconds) can be positive (meaning that the vehicle is late) or
  155. // negative (meaning that the vehicle is ahead of schedule). Delay of 0
  156. // means that the vehicle is exactly on time.
  157. optional int32 delay = 1;
  158. // Event as absolute time.
  159. // In Unix time (i.e., number of seconds since January 1st 1970 00:00:00
  160. // UTC).
  161. optional int64 time = 2;
  162. // If uncertainty is omitted, it is interpreted as unknown.
  163. // If the prediction is unknown or too uncertain, the delay (or time) field
  164. // should be empty. In such case, the uncertainty field is ignored.
  165. // To specify a completely certain prediction, set its uncertainty to 0.
  166. optional int32 uncertainty = 3;
  167. // The extensions namespace allows 3rd-party developers to extend the
  168. // GTFS Realtime Specification in order to add and evaluate new features
  169. // and modifications to the spec.
  170. extensions 1000 to 1999;
  171. // The following extension IDs are reserved for private use by any organization.
  172. extensions 9000 to 9999;
  173. }
  174. // Realtime update for arrival and/or departure events for a given stop on a
  175. // trip. Updates can be supplied for both past and future events.
  176. // The producer is allowed, although not required, to drop past events.
  177. message StopTimeUpdate {
  178. // The update is linked to a specific stop either through stop_sequence or
  179. // stop_id, so one of the fields below must necessarily be set.
  180. // See the documentation in TripDescriptor for more information.
  181. // Must be the same as in stop_times.txt in the corresponding GTFS feed.
  182. optional uint32 stop_sequence = 1;
  183. // Must be the same as in stops.txt in the corresponding GTFS feed.
  184. optional string stop_id = 4;
  185. optional StopTimeEvent arrival = 2;
  186. optional StopTimeEvent departure = 3;
  187. // Expected occupancy after departure from the given stop.
  188. // Should be provided only for future stops.
  189. // In order to provide departure_occupancy_status without either arrival or
  190. // departure StopTimeEvents, ScheduleRelationship should be set to NO_DATA.
  191. optional VehiclePosition.OccupancyStatus departure_occupancy_status = 7;
  192. // The relation between the StopTimeEvents and the static schedule.
  193. enum ScheduleRelationship {
  194. // The vehicle is proceeding in accordance with its static schedule of
  195. // stops, although not necessarily according to the times of the schedule.
  196. // At least one of arrival and departure must be provided. If the schedule
  197. // for this stop contains both arrival and departure times then so must
  198. // this update. Frequency-based trips (GTFS frequencies.txt with exact_times = 0)
  199. // should not have a SCHEDULED value and should use UNSCHEDULED instead.
  200. SCHEDULED = 0;
  201. // The stop is skipped, i.e., the vehicle will not stop at this stop.
  202. // Arrival and departure are optional.
  203. SKIPPED = 1;
  204. // No StopTimeEvents are given for this stop.
  205. // The main intention for this value is to give time predictions only for
  206. // part of a trip, i.e., if the last update for a trip has a NO_DATA
  207. // specifier, then StopTimeEvents for the rest of the stops in the trip
  208. // are considered to be unspecified as well.
  209. // Neither arrival nor departure should be supplied.
  210. NO_DATA = 2;
  211. // The vehicle is operating a trip defined in GTFS frequencies.txt with exact_times = 0.
  212. // This value should not be used for trips that are not defined in GTFS frequencies.txt,
  213. // or trips in GTFS frequencies.txt with exact_times = 1. Trips containing StopTimeUpdates
  214. // with ScheduleRelationship=UNSCHEDULED must also set TripDescriptor.ScheduleRelationship=UNSCHEDULED.
  215. // NOTE: This field is still experimental, and subject to change. It may be
  216. // formally adopted in the future.
  217. UNSCHEDULED = 3;
  218. }
  219. optional ScheduleRelationship schedule_relationship = 5
  220. [default = SCHEDULED];
  221. // Provides the updated values for the stop time.
  222. // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
  223. message StopTimeProperties {
  224. // Supports real-time stop assignments. Refers to a stop_id defined in the GTFS stops.txt.
  225. // The new assigned_stop_id should not result in a significantly different trip experience for the end user than
  226. // the stop_id defined in GTFS stop_times.txt. In other words, the end user should not view this new stop_id as an
  227. // "unusual change" if the new stop was presented within an app without any additional context.
  228. // For example, this field is intended to be used for platform assignments by using a stop_id that belongs to the
  229. // same station as the stop originally defined in GTFS stop_times.txt.
  230. // To assign a stop without providing any real-time arrival or departure predictions, populate this field and set
  231. // StopTimeUpdate.schedule_relationship = NO_DATA.
  232. // If this field is populated, it is preferred to omit `StopTimeUpdate.stop_id` and use only `StopTimeUpdate.stop_sequence`. If
  233. // `StopTimeProperties.assigned_stop_id` and `StopTimeUpdate.stop_id` are populated, `StopTimeUpdate.stop_id` must match `assigned_stop_id`.
  234. // Platform assignments should be reflected in other GTFS-realtime fields as well
  235. // (e.g., `VehiclePosition.stop_id`).
  236. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  237. optional string assigned_stop_id = 1;
  238. // The extensions namespace allows 3rd-party developers to extend the
  239. // GTFS Realtime Specification in order to add and evaluate new features
  240. // and modifications to the spec.
  241. extensions 1000 to 1999;
  242. // The following extension IDs are reserved for private use by any organization.
  243. extensions 9000 to 9999;
  244. }
  245. // Realtime updates for certain properties defined within GTFS stop_times.txt
  246. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  247. optional StopTimeProperties stop_time_properties = 6;
  248. // The extensions namespace allows 3rd-party developers to extend the
  249. // GTFS Realtime Specification in order to add and evaluate new features
  250. // and modifications to the spec.
  251. extensions 1000 to 1999;
  252. // The following extension IDs are reserved for private use by any organization.
  253. extensions 9000 to 9999;
  254. }
  255. // Updates to StopTimes for the trip (both future, i.e., predictions, and in
  256. // some cases, past ones, i.e., those that already happened).
  257. // The updates must be sorted by stop_sequence, and apply for all the
  258. // following stops of the trip up to the next specified one.
  259. //
  260. // Example 1:
  261. // For a trip with 20 stops, a StopTimeUpdate with arrival delay and departure
  262. // delay of 0 for stop_sequence of the current stop means that the trip is
  263. // exactly on time.
  264. //
  265. // Example 2:
  266. // For the same trip instance, 3 StopTimeUpdates are provided:
  267. // - delay of 5 min for stop_sequence 3
  268. // - delay of 1 min for stop_sequence 8
  269. // - delay of unspecified duration for stop_sequence 10
  270. // This will be interpreted as:
  271. // - stop_sequences 3,4,5,6,7 have delay of 5 min.
  272. // - stop_sequences 8,9 have delay of 1 min.
  273. // - stop_sequences 10,... have unknown delay.
  274. repeated StopTimeUpdate stop_time_update = 2;
  275. // The most recent moment at which the vehicle's real-time progress was measured
  276. // to estimate StopTimes in the future. When StopTimes in the past are provided,
  277. // arrival/departure times may be earlier than this value. In POSIX
  278. // time (i.e., the number of seconds since January 1st 1970 00:00:00 UTC).
  279. optional uint64 timestamp = 4;
  280. // The current schedule deviation for the trip. Delay should only be
  281. // specified when the prediction is given relative to some existing schedule
  282. // in GTFS.
  283. //
  284. // Delay (in seconds) can be positive (meaning that the vehicle is late) or
  285. // negative (meaning that the vehicle is ahead of schedule). Delay of 0
  286. // means that the vehicle is exactly on time.
  287. //
  288. // Delay information in StopTimeUpdates take precedent of trip-level delay
  289. // information, such that trip-level delay is only propagated until the next
  290. // stop along the trip with a StopTimeUpdate delay value specified.
  291. //
  292. // Feed providers are strongly encouraged to provide a TripUpdate.timestamp
  293. // value indicating when the delay value was last updated, in order to
  294. // evaluate the freshness of the data.
  295. //
  296. // NOTE: This field is still experimental, and subject to change. It may be
  297. // formally adopted in the future.
  298. optional int32 delay = 5;
  299. // Defines updated properties of the trip, such as a new shape_id when there is a detour. Or defines the
  300. // trip_id, start_date, and start_time of a DUPLICATED trip.
  301. // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
  302. message TripProperties {
  303. // Defines the identifier of a new trip that is a duplicate of an existing trip defined in (CSV) GTFS trips.txt
  304. // but will start at a different service date and/or time (defined using the TripProperties.start_date and
  305. // TripProperties.start_time fields). See definition of trips.trip_id in (CSV) GTFS. Its value must be different
  306. // than the ones used in the (CSV) GTFS. Required if schedule_relationship=DUPLICATED, otherwise this field must not
  307. // be populated and will be ignored by consumers.
  308. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  309. optional string trip_id = 1;
  310. // Service date on which the DUPLICATED trip will be run, in YYYYMMDD format. Required if
  311. // schedule_relationship=DUPLICATED, otherwise this field must not be populated and will be ignored by consumers.
  312. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  313. optional string start_date = 2;
  314. // Defines the departure start time of the trip when it’s duplicated. See definition of stop_times.departure_time
  315. // in (CSV) GTFS. Scheduled arrival and departure times for the duplicated trip are calculated based on the offset
  316. // between the original trip departure_time and this field. For example, if a GTFS trip has stop A with a
  317. // departure_time of 10:00:00 and stop B with departure_time of 10:01:00, and this field is populated with the value
  318. // of 10:30:00, stop B on the duplicated trip will have a scheduled departure_time of 10:31:00. Real-time prediction
  319. // delay values are applied to this calculated schedule time to determine the predicted time. For example, if a
  320. // departure delay of 30 is provided for stop B, then the predicted departure time is 10:31:30. Real-time
  321. // prediction time values do not have any offset applied to them and indicate the predicted time as provided.
  322. // For example, if a departure time representing 10:31:30 is provided for stop B, then the predicted departure time
  323. // is 10:31:30. This field is required if schedule_relationship is DUPLICATED, otherwise this field must not be
  324. // populated and will be ignored by consumers.
  325. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  326. optional string start_time = 3;
  327. // Specifies the shape of the vehicle travel path when the trip shape differs from the shape specified in
  328. // (CSV) GTFS or to specify it in real-time when it's not provided by (CSV) GTFS, such as a vehicle that takes differing
  329. // paths based on rider demand. See definition of trips.shape_id in (CSV) GTFS. If a shape is neither defined in (CSV) GTFS
  330. // nor in real-time, the shape is considered unknown. This field can refer to a shape defined in the (CSV) GTFS in shapes.txt
  331. // or a Shape in the (protobuf) real-time feed. The order of stops (stop sequences) for this trip must remain the same as
  332. // (CSV) GTFS. Stops that are a part of the original trip but will no longer be made, such as when a detour occurs, should
  333. // be marked as schedule_relationship=SKIPPED.
  334. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  335. optional string shape_id = 4;
  336. // The extensions namespace allows 3rd-party developers to extend the
  337. // GTFS Realtime Specification in order to add and evaluate new features
  338. // and modifications to the spec.
  339. extensions 1000 to 1999;
  340. // The following extension IDs are reserved for private use by any organization.
  341. extensions 9000 to 9999;
  342. }
  343. optional TripProperties trip_properties = 6;
  344. // The extensions namespace allows 3rd-party developers to extend the
  345. // GTFS Realtime Specification in order to add and evaluate new features and
  346. // modifications to the spec.
  347. extensions 1000 to 1999;
  348. // The following extension IDs are reserved for private use by any organization.
  349. extensions 9000 to 9999;
  350. }
  351. // Realtime positioning information for a given vehicle.
  352. message VehiclePosition {
  353. // The Trip that this vehicle is serving.
  354. // Can be empty or partial if the vehicle can not be identified with a given
  355. // trip instance.
  356. optional TripDescriptor trip = 1;
  357. // Additional information on the vehicle that is serving this trip.
  358. optional VehicleDescriptor vehicle = 8;
  359. // Current position of this vehicle.
  360. optional Position position = 2;
  361. // The stop sequence index of the current stop. The meaning of
  362. // current_stop_sequence (i.e., the stop that it refers to) is determined by
  363. // current_status.
  364. // If current_status is missing IN_TRANSIT_TO is assumed.
  365. optional uint32 current_stop_sequence = 3;
  366. // Identifies the current stop. The value must be the same as in stops.txt in
  367. // the corresponding GTFS feed.
  368. optional string stop_id = 7;
  369. enum VehicleStopStatus {
  370. // The vehicle is just about to arrive at the stop (on a stop
  371. // display, the vehicle symbol typically flashes).
  372. INCOMING_AT = 0;
  373. // The vehicle is standing at the stop.
  374. STOPPED_AT = 1;
  375. // The vehicle has departed and is in transit to the next stop.
  376. IN_TRANSIT_TO = 2;
  377. }
  378. // The exact status of the vehicle with respect to the current stop.
  379. // Ignored if current_stop_sequence is missing.
  380. optional VehicleStopStatus current_status = 4 [default = IN_TRANSIT_TO];
  381. // Moment at which the vehicle's position was measured. In POSIX time
  382. // (i.e., number of seconds since January 1st 1970 00:00:00 UTC).
  383. optional uint64 timestamp = 5;
  384. // Congestion level that is affecting this vehicle.
  385. enum CongestionLevel {
  386. UNKNOWN_CONGESTION_LEVEL = 0;
  387. RUNNING_SMOOTHLY = 1;
  388. STOP_AND_GO = 2;
  389. CONGESTION = 3;
  390. SEVERE_CONGESTION = 4; // People leaving their cars.
  391. }
  392. optional CongestionLevel congestion_level = 6;
  393. // The state of passenger occupancy for the vehicle or carriage.
  394. // Individual producers may not publish all OccupancyStatus values. Therefore, consumers
  395. // must not assume that the OccupancyStatus values follow a linear scale.
  396. // Consumers should represent OccupancyStatus values as the state indicated
  397. // and intended by the producer. Likewise, producers must use OccupancyStatus values that
  398. // correspond to actual vehicle occupancy states.
  399. // For describing passenger occupancy levels on a linear scale, see `occupancy_percentage`.
  400. // This field is still experimental, and subject to change. It may be formally adopted in the future.
  401. enum OccupancyStatus {
  402. // The vehicle or carriage is considered empty by most measures, and has few or no
  403. // passengers onboard, but is still accepting passengers.
  404. EMPTY = 0;
  405. // The vehicle or carriage has a large number of seats available.
  406. // The amount of free seats out of the total seats available to be
  407. // considered large enough to fall into this category is determined at the
  408. // discretion of the producer.
  409. MANY_SEATS_AVAILABLE = 1;
  410. // The vehicle or carriage has a relatively small number of seats available.
  411. // The amount of free seats out of the total seats available to be
  412. // considered small enough to fall into this category is determined at the
  413. // discretion of the feed producer.
  414. FEW_SEATS_AVAILABLE = 2;
  415. // The vehicle or carriage can currently accommodate only standing passengers.
  416. STANDING_ROOM_ONLY = 3;
  417. // The vehicle or carriage can currently accommodate only standing passengers
  418. // and has limited space for them.
  419. CRUSHED_STANDING_ROOM_ONLY = 4;
  420. // The vehicle or carriage is considered full by most measures, but may still be
  421. // allowing passengers to board.
  422. FULL = 5;
  423. // The vehicle or carriage is not accepting passengers, but usually accepts passengers for boarding.
  424. NOT_ACCEPTING_PASSENGERS = 6;
  425. // The vehicle or carriage doesn't have any occupancy data available at that time.
  426. NO_DATA_AVAILABLE = 7;
  427. // The vehicle or carriage is not boardable and never accepts passengers.
  428. // Useful for special vehicles or carriages (engine, maintenance carriage, etc…).
  429. NOT_BOARDABLE = 8;
  430. }
  431. // If multi_carriage_status is populated with per-carriage OccupancyStatus,
  432. // then this field should describe the entire vehicle with all carriages accepting passengers considered.
  433. optional OccupancyStatus occupancy_status = 9;
  434. // A percentage value indicating the degree of passenger occupancy in the vehicle.
  435. // The values are represented as an integer without decimals. 0 means 0% and 100 means 100%.
  436. // The value 100 should represent the total maximum occupancy the vehicle was designed for,
  437. // including both seated and standing capacity, and current operating regulations allow.
  438. // The value may exceed 100 if there are more passengers than the maximum designed capacity.
  439. // The precision of occupancy_percentage should be low enough that individual passengers cannot be tracked boarding or alighting the vehicle.
  440. // If multi_carriage_status is populated with per-carriage occupancy_percentage,
  441. // then this field should describe the entire vehicle with all carriages accepting passengers considered.
  442. // This field is still experimental, and subject to change. It may be formally adopted in the future.
  443. optional uint32 occupancy_percentage = 10;
  444. // Carriage specific details, used for vehicles composed of several carriages
  445. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  446. message CarriageDetails {
  447. // Identification of the carriage. Should be unique per vehicle.
  448. optional string id = 1;
  449. // User visible label that may be shown to the passenger to help identify
  450. // the carriage. Example: "7712", "Car ABC-32", etc...
  451. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  452. optional string label = 2;
  453. // Occupancy status for this given carriage, in this vehicle
  454. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  455. optional OccupancyStatus occupancy_status = 3 [default = NO_DATA_AVAILABLE];
  456. // Occupancy percentage for this given carriage, in this vehicle.
  457. // Follows the same rules as "VehiclePosition.occupancy_percentage"
  458. // -1 in case data is not available for this given carriage (as protobuf defaults to 0 otherwise)
  459. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  460. optional int32 occupancy_percentage = 4 [default = -1];
  461. // Identifies the order of this carriage with respect to the other
  462. // carriages in the vehicle's list of CarriageDetails.
  463. // The first carriage in the direction of travel must have a value of 1.
  464. // The second value corresponds to the second carriage in the direction
  465. // of travel and must have a value of 2, and so forth.
  466. // For example, the first carriage in the direction of travel has a value of 1.
  467. // If the second carriage in the direction of travel has a value of 3,
  468. // consumers will discard data for all carriages (i.e., the multi_carriage_details field).
  469. // Carriages without data must be represented with a valid carriage_sequence number and the fields
  470. // without data should be omitted (alternately, those fields could also be included and set to the "no data" values).
  471. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  472. optional uint32 carriage_sequence = 5;
  473. // The extensions namespace allows 3rd-party developers to extend the
  474. // GTFS Realtime Specification in order to add and evaluate new features and
  475. // modifications to the spec.
  476. extensions 1000 to 1999;
  477. // The following extension IDs are reserved for private use by any organization.
  478. extensions 9000 to 9999;
  479. }
  480. // Details of the multiple carriages of this given vehicle.
  481. // The first occurrence represents the first carriage of the vehicle,
  482. // given the current direction of travel.
  483. // The number of occurrences of the multi_carriage_details
  484. // field represents the number of carriages of the vehicle.
  485. // It also includes non boardable carriages,
  486. // like engines, maintenance carriages, etc… as they provide valuable
  487. // information to passengers about where to stand on a platform.
  488. // This message/field is still experimental, and subject to change. It may be formally adopted in the future.
  489. repeated CarriageDetails multi_carriage_details = 11;
  490. // The extensions namespace allows 3rd-party developers to extend the
  491. // GTFS Realtime Specification in order to add and evaluate new features and
  492. // modifications to the spec.
  493. extensions 1000 to 1999;
  494. // The following extension IDs are reserved for private use by any organization.
  495. extensions 9000 to 9999;
  496. }
  497. // An alert, indicating some sort of incident in the public transit network.
  498. message Alert {
  499. // Time when the alert should be shown to the user. If missing, the
  500. // alert will be shown as long as it appears in the feed.
  501. // If multiple ranges are given, the alert will be shown during all of them.
  502. repeated TimeRange active_period = 1;
  503. // Entities whose users we should notify of this alert.
  504. repeated EntitySelector informed_entity = 5;
  505. // Cause of this alert.
  506. enum Cause {
  507. UNKNOWN_CAUSE = 1;
  508. OTHER_CAUSE = 2; // Not machine-representable.
  509. TECHNICAL_PROBLEM = 3;
  510. STRIKE = 4; // Public transit agency employees stopped working.
  511. DEMONSTRATION = 5; // People are blocking the streets.
  512. ACCIDENT = 6;
  513. HOLIDAY = 7;
  514. WEATHER = 8;
  515. MAINTENANCE = 9;
  516. CONSTRUCTION = 10;
  517. POLICE_ACTIVITY = 11;
  518. MEDICAL_EMERGENCY = 12;
  519. }
  520. optional Cause cause = 6 [default = UNKNOWN_CAUSE];
  521. // What is the effect of this problem on the affected entity.
  522. enum Effect {
  523. NO_SERVICE = 1;
  524. REDUCED_SERVICE = 2;
  525. // We don't care about INsignificant delays: they are hard to detect, have
  526. // little impact on the user, and would clutter the results as they are too
  527. // frequent.
  528. SIGNIFICANT_DELAYS = 3;
  529. DETOUR = 4;
  530. ADDITIONAL_SERVICE = 5;
  531. MODIFIED_SERVICE = 6;
  532. OTHER_EFFECT = 7;
  533. UNKNOWN_EFFECT = 8;
  534. STOP_MOVED = 9;
  535. NO_EFFECT = 10;
  536. ACCESSIBILITY_ISSUE = 11;
  537. }
  538. optional Effect effect = 7 [default = UNKNOWN_EFFECT];
  539. // The URL which provides additional information about the alert.
  540. optional TranslatedString url = 8;
  541. // Alert header. Contains a short summary of the alert text as plain-text.
  542. optional TranslatedString header_text = 10;
  543. // Full description for the alert as plain-text. The information in the
  544. // description should add to the information of the header.
  545. optional TranslatedString description_text = 11;
  546. // Text for alert header to be used in text-to-speech implementations. This field is the text-to-speech version of header_text.
  547. optional TranslatedString tts_header_text = 12;
  548. // Text for full description for the alert to be used in text-to-speech implementations. This field is the text-to-speech version of description_text.
  549. optional TranslatedString tts_description_text = 13;
  550. // Severity of this alert.
  551. enum SeverityLevel {
  552. UNKNOWN_SEVERITY = 1;
  553. INFO = 2;
  554. WARNING = 3;
  555. SEVERE = 4;
  556. }
  557. optional SeverityLevel severity_level = 14 [default = UNKNOWN_SEVERITY];
  558. // The extensions namespace allows 3rd-party developers to extend the
  559. // GTFS Realtime Specification in order to add and evaluate new features
  560. // and modifications to the spec.
  561. extensions 1000 to 1999;
  562. // The following extension IDs are reserved for private use by any organization.
  563. extensions 9000 to 9999;
  564. }
  565. //
  566. // Low level data structures used above.
  567. //
  568. // A time interval. The interval is considered active at time 't' if 't' is
  569. // greater than or equal to the start time and less than the end time.
  570. message TimeRange {
  571. // Start time, in POSIX time (i.e., number of seconds since January 1st 1970
  572. // 00:00:00 UTC).
  573. // If missing, the interval starts at minus infinity.
  574. optional uint64 start = 1;
  575. // End time, in POSIX time (i.e., number of seconds since January 1st 1970
  576. // 00:00:00 UTC).
  577. // If missing, the interval ends at plus infinity.
  578. optional uint64 end = 2;
  579. // The extensions namespace allows 3rd-party developers to extend the
  580. // GTFS Realtime Specification in order to add and evaluate new features and
  581. // modifications to the spec.
  582. extensions 1000 to 1999;
  583. // The following extension IDs are reserved for private use by any organization.
  584. extensions 9000 to 9999;
  585. }
  586. // A position.
  587. message Position {
  588. // Degrees North, in the WGS-84 coordinate system.
  589. required float latitude = 1;
  590. // Degrees East, in the WGS-84 coordinate system.
  591. required float longitude = 2;
  592. // Bearing, in degrees, clockwise from North, i.e., 0 is North and 90 is East.
  593. // This can be the compass bearing, or the direction towards the next stop
  594. // or intermediate location.
  595. // This should not be direction deduced from the sequence of previous
  596. // positions, which can be computed from previous data.
  597. optional float bearing = 3;
  598. // Odometer value, in meters.
  599. optional double odometer = 4;
  600. // Momentary speed measured by the vehicle, in meters per second.
  601. optional float speed = 5;
  602. // The extensions namespace allows 3rd-party developers to extend the
  603. // GTFS Realtime Specification in order to add and evaluate new features and
  604. // modifications to the spec.
  605. extensions 1000 to 1999;
  606. // The following extension IDs are reserved for private use by any organization.
  607. extensions 9000 to 9999;
  608. }
  609. // A descriptor that identifies an instance of a GTFS trip, or all instances of
  610. // a trip along a route.
  611. // - To specify a single trip instance, the trip_id (and if necessary,
  612. // start_time) is set. If route_id is also set, then it should be same as one
  613. // that the given trip corresponds to.
  614. // - To specify all the trips along a given route, only the route_id should be
  615. // set. Note that if the trip_id is not known, then stop sequence ids in
  616. // TripUpdate are not sufficient, and stop_ids must be provided as well. In
  617. // addition, absolute arrival/departure times must be provided.
  618. message TripDescriptor {
  619. // The trip_id from the GTFS feed that this selector refers to.
  620. // For non frequency-based trips, this field is enough to uniquely identify
  621. // the trip. For frequency-based trip, start_time and start_date might also be
  622. // necessary. When schedule_relationship is DUPLICATED within a TripUpdate, the trip_id identifies the trip from
  623. // static GTFS to be duplicated. When schedule_relationship is DUPLICATED within a VehiclePosition, the trip_id
  624. // identifies the new duplicate trip and must contain the value for the corresponding TripUpdate.TripProperties.trip_id.
  625. optional string trip_id = 1;
  626. // The route_id from the GTFS that this selector refers to.
  627. optional string route_id = 5;
  628. // The direction_id from the GTFS feed trips.txt file, indicating the
  629. // direction of travel for trips this selector refers to.
  630. optional uint32 direction_id = 6;
  631. // The initially scheduled start time of this trip instance.
  632. // When the trip_id corresponds to a non-frequency-based trip, this field
  633. // should either be omitted or be equal to the value in the GTFS feed. When
  634. // the trip_id correponds to a frequency-based trip, the start_time must be
  635. // specified for trip updates and vehicle positions. If the trip corresponds
  636. // to exact_times=1 GTFS record, then start_time must be some multiple
  637. // (including zero) of headway_secs later than frequencies.txt start_time for
  638. // the corresponding time period. If the trip corresponds to exact_times=0,
  639. // then its start_time may be arbitrary, and is initially expected to be the
  640. // first departure of the trip. Once established, the start_time of this
  641. // frequency-based trip should be considered immutable, even if the first
  642. // departure time changes -- that time change may instead be reflected in a
  643. // StopTimeUpdate.
  644. // Format and semantics of the field is same as that of
  645. // GTFS/frequencies.txt/start_time, e.g., 11:15:35 or 25:15:35.
  646. optional string start_time = 2;
  647. // The scheduled start date of this trip instance.
  648. // Must be provided to disambiguate trips that are so late as to collide with
  649. // a scheduled trip on a next day. For example, for a train that departs 8:00
  650. // and 20:00 every day, and is 12 hours late, there would be two distinct
  651. // trips on the same time.
  652. // This field can be provided but is not mandatory for schedules in which such
  653. // collisions are impossible - for example, a service running on hourly
  654. // schedule where a vehicle that is one hour late is not considered to be
  655. // related to schedule anymore.
  656. // In YYYYMMDD format.
  657. optional string start_date = 3;
  658. // The relation between this trip and the static schedule. If a trip is done
  659. // in accordance with temporary schedule, not reflected in GTFS, then it
  660. // shouldn't be marked as SCHEDULED, but likely as ADDED.
  661. enum ScheduleRelationship {
  662. // Trip that is running in accordance with its GTFS schedule, or is close
  663. // enough to the scheduled trip to be associated with it.
  664. SCHEDULED = 0;
  665. // An extra trip that was added in addition to a running schedule, for
  666. // example, to replace a broken vehicle or to respond to sudden passenger
  667. // load.
  668. // NOTE: Currently, behavior is unspecified for feeds that use this mode. There are discussions on the GTFS GitHub
  669. // [(1)](https://github.com/google/transit/issues/106) [(2)](https://github.com/google/transit/pull/221)
  670. // [(3)](https://github.com/google/transit/pull/219) around fully specifying or deprecating ADDED trips and the
  671. // documentation will be updated when those discussions are finalized.
  672. ADDED = 1;
  673. // A trip that is running with no schedule associated to it (GTFS frequencies.txt exact_times=0).
  674. // Trips with ScheduleRelationship=UNSCHEDULED must also set all StopTimeUpdates.ScheduleRelationship=UNSCHEDULED.
  675. UNSCHEDULED = 2;
  676. // A trip that existed in the schedule but was removed.
  677. CANCELED = 3;
  678. // Should not be used - for backwards-compatibility only.
  679. REPLACEMENT = 5 [deprecated=true];
  680. // An extra trip that was added in addition to a running schedule, for example, to replace a broken vehicle or to
  681. // respond to sudden passenger load. Used with TripUpdate.TripProperties.trip_id, TripUpdate.TripProperties.start_date,
  682. // and TripUpdate.TripProperties.start_time to copy an existing trip from static GTFS but start at a different service
  683. // date and/or time. Duplicating a trip is allowed if the service related to the original trip in (CSV) GTFS
  684. // (in calendar.txt or calendar_dates.txt) is operating within the next 30 days. The trip to be duplicated is
  685. // identified via TripUpdate.TripDescriptor.trip_id. This enumeration does not modify the existing trip referenced by
  686. // TripUpdate.TripDescriptor.trip_id - if a producer wants to cancel the original trip, it must publish a separate
  687. // TripUpdate with the value of CANCELED. Trips defined in GTFS frequencies.txt with exact_times that is empty or
  688. // equal to 0 cannot be duplicated. The VehiclePosition.TripDescriptor.trip_id for the new trip must contain
  689. // the matching value from TripUpdate.TripProperties.trip_id and VehiclePosition.TripDescriptor.ScheduleRelationship
  690. // must also be set to DUPLICATED.
  691. // Existing producers and consumers that were using the ADDED enumeration to represent duplicated trips must follow
  692. // the migration guide (https://github.com/google/transit/tree/master/gtfs-realtime/spec/en/examples/migration-duplicated.md)
  693. // to transition to the DUPLICATED enumeration.
  694. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  695. DUPLICATED = 6;
  696. }
  697. optional ScheduleRelationship schedule_relationship = 4;
  698. // The extensions namespace allows 3rd-party developers to extend the
  699. // GTFS Realtime Specification in order to add and evaluate new features and
  700. // modifications to the spec.
  701. extensions 1000 to 1999;
  702. // The following extension IDs are reserved for private use by any organization.
  703. extensions 9000 to 9999;
  704. }
  705. // Identification information for the vehicle performing the trip.
  706. message VehicleDescriptor {
  707. // Internal system identification of the vehicle. Should be unique per
  708. // vehicle, and can be used for tracking the vehicle as it proceeds through
  709. // the system.
  710. optional string id = 1;
  711. // User visible label, i.e., something that must be shown to the passenger to
  712. // help identify the correct vehicle.
  713. optional string label = 2;
  714. // The license plate of the vehicle.
  715. optional string license_plate = 3;
  716. // The extensions namespace allows 3rd-party developers to extend the
  717. // GTFS Realtime Specification in order to add and evaluate new features and
  718. // modifications to the spec.
  719. extensions 1000 to 1999;
  720. // The following extension IDs are reserved for private use by any organization.
  721. extensions 9000 to 9999;
  722. }
  723. // A selector for an entity in a GTFS feed.
  724. message EntitySelector {
  725. // The values of the fields should correspond to the appropriate fields in the
  726. // GTFS feed.
  727. // At least one specifier must be given. If several are given, then the
  728. // matching has to apply to all the given specifiers.
  729. optional string agency_id = 1;
  730. optional string route_id = 2;
  731. // corresponds to route_type in GTFS.
  732. optional int32 route_type = 3;
  733. optional TripDescriptor trip = 4;
  734. optional string stop_id = 5;
  735. // Corresponds to trip direction_id in GTFS trips.txt. If provided the
  736. // route_id must also be provided.
  737. optional uint32 direction_id = 6;
  738. // The extensions namespace allows 3rd-party developers to extend the
  739. // GTFS Realtime Specification in order to add and evaluate new features and
  740. // modifications to the spec.
  741. extensions 1000 to 1999;
  742. // The following extension IDs are reserved for private use by any organization.
  743. extensions 9000 to 9999;
  744. }
  745. // An internationalized message containing per-language versions of a snippet of
  746. // text or a URL.
  747. // One of the strings from a message will be picked up. The resolution proceeds
  748. // as follows:
  749. // 1. If the UI language matches the language code of a translation,
  750. // the first matching translation is picked.
  751. // 2. If a default UI language (e.g., English) matches the language code of a
  752. // translation, the first matching translation is picked.
  753. // 3. If some translation has an unspecified language code, that translation is
  754. // picked.
  755. message TranslatedString {
  756. message Translation {
  757. // A UTF-8 string containing the message.
  758. required string text = 1;
  759. // BCP-47 language code. Can be omitted if the language is unknown or if
  760. // no i18n is done at all for the feed. At most one translation is
  761. // allowed to have an unspecified language tag.
  762. optional string language = 2;
  763. // The extensions namespace allows 3rd-party developers to extend the
  764. // GTFS Realtime Specification in order to add and evaluate new features and
  765. // modifications to the spec.
  766. extensions 1000 to 1999;
  767. // The following extension IDs are reserved for private use by any organization.
  768. extensions 9000 to 9999;
  769. }
  770. // At least one translation must be provided.
  771. repeated Translation translation = 1;
  772. // The extensions namespace allows 3rd-party developers to extend the
  773. // GTFS Realtime Specification in order to add and evaluate new features and
  774. // modifications to the spec.
  775. extensions 1000 to 1999;
  776. // The following extension IDs are reserved for private use by any organization.
  777. extensions 9000 to 9999;
  778. }
  779. // Describes the physical path that a vehicle takes when it's not part of the (CSV) GTFS,
  780. // such as for a detour. Shapes belong to Trips, and consist of a sequence of shape points.
  781. // Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept
  782. // the location of Stops exactly, but all Stops on a trip should lie within a small distance of
  783. // the shape for that trip, i.e. close to straight line segments connecting the shape points
  784. // NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
  785. message Shape {
  786. // Identifier of the shape. Must be different than any shape_id defined in the (CSV) GTFS.
  787. // This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
  788. // See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
  789. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  790. optional string shape_id = 1;
  791. // Encoded polyline representation of the shape. This polyline must contain at least two points.
  792. // For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
  793. // This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
  794. // See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
  795. // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
  796. optional string encoded_polyline = 2;
  797. // The extensions namespace allows 3rd-party developers to extend the
  798. // GTFS Realtime Specification in order to add and evaluate new features and
  799. // modifications to the spec.
  800. extensions 1000 to 1999;
  801. // The following extension IDs are reserved for private use by any organization.
  802. extensions 9000 to 9999;
  803. }