avm99963 | 99bb77c | 2020-01-27 03:15:08 +0100 | [diff] [blame] | 1 | // Copyright 2012 Google Inc., Stichting OpenGeo, avm99963 |
| 2 | // |
| 3 | // The content of this file is licensed under the Creative Commons Attribution |
| 4 | // 3.0 License. |
| 5 | // |
| 6 | // Protocol definition file for a GTFS feed. |
| 7 | |
| 8 | syntax = "proto3"; |
| 9 | |
| 10 | import "google/protobuf/any.proto"; |
| 11 | package gtfs; |
| 12 | |
| 13 | message FeedMessage { |
| 14 | // Metadata about this feed and feed message. |
| 15 | FeedHeader header = 1; |
| 16 | |
| 17 | // Contents of the feed. |
| 18 | repeated FeedEntity entity = 2; |
| 19 | } |
| 20 | |
| 21 | // Metadata about a feed, included in feed messages. |
| 22 | message FeedHeader { |
| 23 | // Version of the feed specification. |
| 24 | // The current version is 1.0. |
| 25 | string gtfs_version = 1; |
| 26 | |
| 27 | // The feed_publisher_name field contains the full name of the organization that publishes the feed. |
| 28 | string feed_publisher_name = 2; |
| 29 | |
| 30 | // The feed_publisher_url field contains the URL of the feed publishing organization's website. |
| 31 | string feed_publisher_url = 3; |
| 32 | |
| 33 | // The feed_lang field contains a IETF BCP 47 language code specifying the default language used for the text in this feed. |
| 34 | string feed_lang = 4; |
| 35 | |
| 36 | // The feed provides complete and reliable schedule information for service in the period from the beginning of the |
| 37 | // feed_start_date day to the end of the feed_end_date day in YYYYMMDD |
| 38 | string feed_start_date = 5; |
| 39 | string feed_end_date = 6; |
| 40 | |
| 41 | // The feed publisher can specify a string here that indicates the current version of their GTFS feed. |
| 42 | string feed_version = 7; |
| 43 | |
| 44 | // The extensions namespace allows 3rd-party developers to extend the |
| 45 | // GTFS specification in order to add and evaluate new features and |
| 46 | // modifications to the spec. |
| 47 | google.protobuf.Any extension = 2000; |
| 48 | reserved 1000 to 1999; |
| 49 | } |
| 50 | |
| 51 | // A definition (or update) of an entity in the transit feed. |
| 52 | message FeedEntity { |
| 53 | // The ids are used only to provide incrementality support. The id should be |
| 54 | // unique within a FeedMessage. Consequent FeedMessages may contain |
| 55 | // FeedEntities with the same id. In case of a DIFFERENTIAL update the new |
| 56 | // FeedEntity with some id will replace the old FeedEntity with the same id |
| 57 | // (or delete it - see is_deleted below). |
| 58 | // The actual GTFS entities (e.g. stations, routes, trips) referenced by the |
| 59 | // feed must be specified by explicit selectors (see EntitySelector below for |
| 60 | // more info). |
| 61 | string id = 1; |
| 62 | |
| 63 | // Whether this entity is to be deleted. Relevant only for incremental |
| 64 | // fetches. |
| 65 | bool is_deleted = 2; |
| 66 | |
| 67 | // Data about the entity itself. Exactly one of the following fields must be |
| 68 | // present (unless the entity is being deleted). |
| 69 | oneof element { |
| 70 | Agency agency = 3; |
| 71 | Stop stop = 4; |
| 72 | Route route = 5; |
| 73 | Trip trip = 6; |
| 74 | StopTime stop_time = 7; |
| 75 | Calendar calendar = 8; |
| 76 | CalendarDate calendar_date = 9; |
| 77 | FareAttribute fare_attribute = 10; |
| 78 | FareRule fare_rule = 11; |
| 79 | Shape shape = 12; |
| 80 | Frequency frequency = 13; |
| 81 | Transfer transfer = 14; |
| 82 | } |
| 83 | |
| 84 | google.protobuf.Any extension = 2000; |
| 85 | reserved 1000 to 1999; |
| 86 | } |
| 87 | |
| 88 | // |
| 89 | // Entities used in the feed. |
| 90 | // |
| 91 | |
| 92 | message Agency { |
| 93 | // The agency_id field is an ID that uniquely identifies a transit agency. |
| 94 | string agency_id = 1; |
| 95 | |
| 96 | // The agency_name field contains the full name of the transit agency. |
| 97 | string agency_name = 2; |
| 98 | |
| 99 | // The agency_url field contains the URL of the transit agency. |
| 100 | string agency_url = 3; |
| 101 | |
| 102 | // The agency_timezone field contains the timezone where the transit agency is located. |
| 103 | string agency_timezone = 4; |
| 104 | |
| 105 | // The agency_lang field contains a two-letter ISO 639-1 code for the primary language used by this transit agency. |
| 106 | string agency_lang = 5; |
| 107 | |
| 108 | // The agency_phone field contains a single voice telephone number for the specified agency. |
| 109 | string agency_phone = 6; |
| 110 | |
| 111 | // The agency_fare_url specifies the URL of a web page that allows a rider to purchase tickets or other fare instruments for that agency online. |
| 112 | string agency_fare_url = 7; |
| 113 | |
| 114 | // GTFS specification in order to add and evaluate new features and |
| 115 | // modifications to the spec. |
| 116 | google.protobuf.Any extension = 2000; |
| 117 | reserved 1000 to 1999; |
| 118 | } |
| 119 | |
| 120 | message Stop { |
| 121 | // The stop_id field contains an ID that uniquely identifies a stop or station. |
| 122 | // Multiple routes may use the same stop. stop_id is dataset unique. |
| 123 | string stop_id = 1; |
| 124 | |
| 125 | // The stop_code field contains short text or a number that uniquely identifies the stop for passengers. |
| 126 | string stop_code = 2; |
| 127 | |
| 128 | // The stop_name field contains the name of a stop or station. |
| 129 | string stop_name = 3; |
| 130 | |
| 131 | // The stop_desc field contains a description of a stop. |
| 132 | string stop_desc = 4; |
| 133 | |
| 134 | // Degrees North, in the WGS-84 coordinate system. |
| 135 | float latitude = 5; |
| 136 | |
| 137 | // Degrees East, in the WGS-84 coordinate system. |
| 138 | float longitude = 6; |
| 139 | |
| 140 | string zone_id = 7; |
| 141 | string stop_url = 8; |
| 142 | enum LocationType { |
| 143 | // Stop (or Platform). A location where passengers board or disembark from a transit vehicle. Is called a platform when defined within a parent_station. |
| 144 | STOP = 0; |
| 145 | |
| 146 | // Station. A physical structure or area that contains one or more platform. |
| 147 | STATION = 1; |
| 148 | |
| 149 | // Entrance/Exit. A location where passengers can enter or exit a station from the street. If an entrance/exit belongs to multiple stations, it can be linked by pathways to both, but the data provider must pick one of them as parent. |
| 150 | ENTRANCE= 2; |
| 151 | |
| 152 | // Generic Node. A location within a station, not matching any other location_type, which can be used to link together pathways define in pathways.txt. |
| 153 | GENERIC_NODE = 3; |
| 154 | |
| 155 | // Boarding Area. A specific location on a platform, where passengers can board and/or alight vehicles. |
| 156 | BOARDING_AREA = 4; |
| 157 | } |
| 158 | LocationType location_type = 9; |
| 159 | |
| 160 | string parent_station = 10; |
| 161 | string agency_timezone = 11; |
| 162 | |
| 163 | enum WheelchairBoarding { |
| 164 | // no accessibility information for the stop |
| 165 | UNKNOWN = 0; |
| 166 | |
| 167 | // some vehicles at this stop can be boarded by a rider in a wheelchair |
| 168 | ACCESSIBLE = 1; |
| 169 | |
| 170 | // wheelchair boarding is not possible at this stop |
| 171 | NOT_ACCESSIBLE = 2; |
| 172 | } |
| 173 | // The exact status of the vehicle with respect to the current stop. |
| 174 | // Ignored if current_stop_sequence is missing. |
| 175 | WheelchairBoarding wheelchair_boarding = 12; |
| 176 | |
| 177 | // The extensions namespace allows 3rd-party developers to extend the |
| 178 | // GTFS specification in order to add and evaluate new features and |
| 179 | // modifications to the spec. |
| 180 | google.protobuf.Any extension = 2000; |
| 181 | reserved 1000 to 1999; |
| 182 | } |
| 183 | |
| 184 | message Route { |
| 185 | // The route_id field contains an ID that uniquely identifies a route. |
| 186 | // The route_id is dataset unique. |
| 187 | string route_id = 1; |
| 188 | |
| 189 | // The agency_id field defines an agency for the specified route. |
| 190 | string agency_id = 2; |
| 191 | |
| 192 | // The route_short_name contains the short name of a route. |
| 193 | string route_short_name = 3; |
| 194 | |
| 195 | // The route_long_name contains the full name of a route. |
| 196 | string route_long_name = 4; |
| 197 | |
| 198 | // The route_desc field contains a description of a route. |
| 199 | string route_desc = 5; |
| 200 | |
| 201 | // The route_type field describes the type of transportation used on a route. |
| 202 | enum RouteType { |
| 203 | // Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area. |
| 204 | TRAM = 0; |
| 205 | |
| 206 | // Subway, Metro. Any underground rail system within a metropolitan area. |
| 207 | SUBWAY = 1; |
| 208 | |
| 209 | // Rail. Used for intercity or long-distance travel. |
| 210 | RAIL = 2; |
| 211 | |
| 212 | // Bus. Used for short- and long-distance bus routes. |
| 213 | BUS = 3; |
| 214 | |
| 215 | // Ferry. Used for short- and long-distance boat service. |
| 216 | FERRY = 4; |
| 217 | |
| 218 | // Cable car. Used for street-level cable cars where the cable runs beneath the car. |
| 219 | CABLECAR = 5; |
| 220 | |
| 221 | // Gondola, Suspended cable car. Typically used for aerial cable cars where the car is suspended from the cable. |
| 222 | GONDOLA = 6; |
| 223 | |
| 224 | // Funicular. Any rail system designed for steep inclines. |
| 225 | FUNICULAR = 7; |
| 226 | } |
| 227 | RouteType route_type = 6; |
| 228 | |
| 229 | // The route_url field contains the URL of a web page about that particular route. |
| 230 | string route_url = 7; |
| 231 | |
| 232 | // In systems that have colors assigned to routes, the route_color field defines a color that corresponds to a route. |
| 233 | // The color must be provided as a six-character hexadecimal number, for example, 00FFFF. |
| 234 | string route_color = 8; |
| 235 | |
| 236 | // The route_text_color field can be used to specify a legible color to use for text drawn against a background of route_color. |
| 237 | string route_text_color = 9; |
| 238 | |
| 239 | // The extensions namespace allows 3rd-party developers to extend the |
| 240 | // GTFS specification in order to add and evaluate new features and |
| 241 | // modifications to the spec. |
| 242 | google.protobuf.Any extension = 2000; |
| 243 | reserved 1000 to 1999; |
| 244 | } |
| 245 | |
| 246 | |
| 247 | message Trip { |
| 248 | // The route_id field contains an ID that uniquely identifies a route. |
| 249 | string route_id = 1; |
| 250 | |
| 251 | // The service_id contains an ID that uniquely identifies a set of dates when service is available for one or more routes. |
| 252 | string service_id = 2; |
| 253 | |
| 254 | // The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique. |
| 255 | string trip_id = 3; |
| 256 | |
| 257 | // The trip_headsign field contains the text that appears on a sign that identifies the trip's destination to passengers. |
| 258 | string trip_headsign = 4; |
| 259 | |
| 260 | // The trip_short_name field contains the text that appears in schedules and sign boards to identify the trip to passengers. |
| 261 | string trip_short_name = 5; |
| 262 | |
| 263 | // The direction_id field contains a binary value that indicates the direction of travel for a trip. |
| 264 | enum Direction { |
| 265 | OUTBOUND = 0; |
| 266 | |
| 267 | INBOUND = 1; |
| 268 | } |
| 269 | Direction direction_id = 6; |
| 270 | |
| 271 | // The block_id field identifies the block to which the trip belongs. |
| 272 | // A block consists of two or more sequential trips made using the same vehicle, |
| 273 | // where a passenger can transfer from one trip to the next just by staying in the vehicle. |
| 274 | string block_id = 7; |
| 275 | |
| 276 | // The shape_id field contains an ID that defines a shape for the trip. |
| 277 | string shape_id = 8; |
| 278 | |
| 279 | // The extensions namespace allows 3rd-party developers to extend the |
| 280 | // GTFS specification in order to add and evaluate new features and |
| 281 | // modifications to the spec. |
| 282 | google.protobuf.Any extension = 2000; |
| 283 | reserved 1000 to 1999; |
| 284 | } |
| 285 | |
| 286 | message StopTime { |
| 287 | // The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique. |
| 288 | string trip_id = 1; |
| 289 | |
| 290 | string arrival_time = 2; |
| 291 | string departure_time = 3; |
| 292 | |
| 293 | // TODO: Brian why not make this: |
| 294 | // int32 arrival_time_secs = 2; |
| 295 | // int32 departure_time_secs = 3; |
| 296 | |
| 297 | string stop_id = 4; |
| 298 | string stop_sequence = 5; |
| 299 | |
| 300 | string stop_headsign = 6; |
| 301 | |
| 302 | enum AvailabilityType { |
| 303 | // Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area. |
| 304 | REGULAR = 0; |
| 305 | |
| 306 | // Subway, Metro. Any underground rail system within a metropolitan area. |
| 307 | NOT_AVAILABLE = 1; |
| 308 | |
| 309 | // Rail. Used for intercity or long-distance travel. |
| 310 | PHONE = 2; |
| 311 | |
| 312 | // Bus. Used for short- and long-distance bus routes. |
| 313 | DRIVER = 3; |
| 314 | } |
| 315 | AvailabilityType pickup_type = 7; |
| 316 | |
| 317 | AvailabilityType drop_off_type = 8; |
| 318 | |
| 319 | float shape_dist_traveled = 9; |
| 320 | |
| 321 | // The extensions namespace allows 3rd-party developers to extend the |
| 322 | // GTFS specification in order to add and evaluate new features and |
| 323 | // modifications to the spec. |
| 324 | google.protobuf.Any extension = 2000; |
| 325 | reserved 1000 to 1999; |
| 326 | } |
| 327 | |
| 328 | message Calendar { |
| 329 | // The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique. |
| 330 | string service_id = 1; |
| 331 | |
| 332 | enum CalendarDay { |
| 333 | NOT_AVAILABLE = 0; |
| 334 | AVAILABLE = 1; |
| 335 | } |
| 336 | CalendarDay monday = 2; |
| 337 | CalendarDay tuesday = 3; |
| 338 | CalendarDay wednesday = 4; |
| 339 | CalendarDay thursday = 5; |
| 340 | CalendarDay friday = 6; |
| 341 | CalendarDay saturday = 7; |
| 342 | CalendarDay sunday = 8; |
| 343 | |
| 344 | string start_date = 9; |
| 345 | string end_date = 10; |
| 346 | |
| 347 | // The extensions namespace allows 3rd-party developers to extend the |
| 348 | // GTFS specification in order to add and evaluate new features and |
| 349 | // modifications to the spec. |
| 350 | google.protobuf.Any extension = 2000; |
| 351 | reserved 1000 to 1999; |
| 352 | } |
| 353 | |
| 354 | message CalendarDate { |
| 355 | // The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique. |
| 356 | string service_id = 1; |
| 357 | |
| 358 | string date = 2; |
| 359 | |
| 360 | enum ExceptionType { |
| 361 | UNUSED_UNKNOWN = 0; |
| 362 | ADDED = 1; |
| 363 | REMOVED = 2; |
| 364 | } |
| 365 | ExceptionType exception_type = 3; |
| 366 | |
| 367 | // The extensions namespace allows 3rd-party developers to extend the |
| 368 | // GTFS specification in order to add and evaluate new features and |
| 369 | // modifications to the spec. |
| 370 | google.protobuf.Any extension = 2000; |
| 371 | reserved 1000 to 1999; |
| 372 | } |
| 373 | |
| 374 | message FareAttribute { |
| 375 | string fare_id = 1; |
| 376 | float price = 2; |
| 377 | string currency_type = 3; |
| 378 | |
| 379 | enum PaymentMethod { |
| 380 | ONBOARD = 0; |
| 381 | PREBOARDING = 1; |
| 382 | } |
| 383 | PaymentMethod payment_method = 4; |
| 384 | |
| 385 | enum Transfers { |
| 386 | NO = 0; |
| 387 | ONCE = 1; |
| 388 | TWICE = 2; |
| 389 | UNLIMITED = 3; |
| 390 | } |
| 391 | Transfers transfers = 5; |
| 392 | |
| 393 | int32 transfer_duration = 6; |
| 394 | |
| 395 | // The extensions namespace allows 3rd-party developers to extend the |
| 396 | // GTFS specification in order to add and evaluate new features and |
| 397 | // modifications to the spec. |
| 398 | google.protobuf.Any extension = 2000; |
| 399 | reserved 1000 to 1999; |
| 400 | } |
| 401 | |
| 402 | message FareRule { |
| 403 | string fare_id = 1; |
| 404 | string route_id = 2; |
| 405 | string origin_id = 3; |
| 406 | string destination_id = 4; |
| 407 | string contains_id = 5; |
| 408 | // The extensions namespace allows 3rd-party developers to extend the |
| 409 | // GTFS specification in order to add and evaluate new features and |
| 410 | // modifications to the spec. |
| 411 | google.protobuf.Any extension = 2000; |
| 412 | reserved 1000 to 1999; |
| 413 | } |
| 414 | |
| 415 | message Shape { |
| 416 | string shape_id = 1; |
| 417 | float shape_pt_lat = 2; |
| 418 | float shape_pt_lon = 3; |
| 419 | int32 shape_pt_sequence = 4; |
| 420 | float shape_dist_traveled = 5; |
| 421 | |
| 422 | // The extensions namespace allows 3rd-party developers to extend the |
| 423 | // GTFS specification in order to add and evaluate new features and |
| 424 | // modifications to the spec. |
| 425 | google.protobuf.Any extension = 2000; |
| 426 | reserved 1000 to 1999; |
| 427 | } |
| 428 | |
| 429 | message Frequency { |
| 430 | string trip_id = 1; |
| 431 | string start_time = 2; |
| 432 | string end_time = 3; |
| 433 | int32 headway_secs = 4; |
| 434 | enum ScheduleType { |
| 435 | NOT_EXACTLY = 0; |
| 436 | EXACTLY = 1; |
| 437 | } |
| 438 | ScheduleType exact_times = 5; |
| 439 | // The extensions namespace allows 3rd-party developers to extend the |
| 440 | // GTFS specification in order to add and evaluate new features and |
| 441 | // modifications to the spec. |
| 442 | google.protobuf.Any extension = 2000; |
| 443 | reserved 1000 to 1999; |
| 444 | } |
| 445 | |
| 446 | message Transfer { |
| 447 | string from_stop_id = 1; |
| 448 | string to_stop_id = 2; |
| 449 | enum TransferType { |
| 450 | RECOMMENDED = 0; |
| 451 | TIMED = 1; |
| 452 | MINIMUM = 2; |
| 453 | NOT_POSSIBLE = 3; |
| 454 | } |
| 455 | TransferType transfer_type = 3; |
| 456 | |
| 457 | int32 min_transfer_time = 4; |
| 458 | |
| 459 | // The extensions namespace allows 3rd-party developers to extend the |
| 460 | // GTFS specification in order to add and evaluate new features and |
| 461 | // modifications to the spec. |
| 462 | google.protobuf.Any extension = 2000; |
| 463 | reserved 1000 to 1999; |
| 464 | } |