diff --git a/gtfs-realtime/proto/gtfs-realtime.proto b/gtfs-realtime/proto/gtfs-realtime.proto
index bcd7d8823..9523a144f 100644
--- a/gtfs-realtime/proto/gtfs-realtime.proto
+++ b/gtfs-realtime/proto/gtfs-realtime.proto
@@ -103,9 +103,9 @@ message FeedEntity {
optional TripUpdate trip_update = 3;
optional VehiclePosition vehicle = 4;
optional Alert alert = 5;
-
- // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional Shape shape = 6;
+ optional Stop stop = 7;
+ optional TripModifications trip_modifications = 8;
// The extensions namespace allows 3rd-party developers to extend the
// GTFS Realtime Specification in order to add and evaluate new features and
@@ -1010,19 +1010,16 @@ message TranslatedImage {
// Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept
// the location of Stops exactly, but all Stops on a trip should lie within a small distance of
// the shape for that trip, i.e. close to straight line segments connecting the shape points
-// NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
message Shape {
// Identifier of the shape. Must be different than any shape_id defined in the (CSV) GTFS.
// This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
// See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
- // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional string shape_id = 1;
// Encoded polyline representation of the shape. This polyline must contain at least two points.
// For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
// This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
// See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
- // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional string encoded_polyline = 2;
// The extensions namespace allows 3rd-party developers to extend the
@@ -1033,3 +1030,99 @@ message Shape {
// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}
+
+// Describes a stop which is served by trips. All fields are as described in the GTFS-Static specification.
+message Stop {
+ enum WheelchairBoarding {
+ UNKNOWN = 0;
+ AVAILABLE = 1;
+ NOT_AVAILABLE = 2;
+ }
+
+ required string stop_id = 1;
+ optional TranslatedString stop_code = 2;
+ optional TranslatedString stop_name = 3;
+ optional TranslatedString tts_stop_name = 4;
+ optional TranslatedString stop_desc = 5;
+ optional float stop_lat = 6;
+ optional float stop_lon = 7;
+ optional string zone_id = 8;
+ optional TranslatedString stop_url = 9;
+ optional string parent_station = 11;
+ optional string stop_timezone = 12;
+ optional WheelchairBoarding wheelchair_boarding = 13 [default = UNKNOWN];
+ optional string level_id = 14;
+ optional TranslatedString platform_code = 15;
+
+ // The extensions namespace allows 3rd-party developers to extend the
+ // GTFS Realtime Specification in order to add and evaluate new features and
+ // modifications to the spec.
+ extensions 1000 to 1999;
+
+ // The following extension IDs are reserved for private use by any organization.
+ extensions 9000 to 9999;
+}
+
+message TripModifications {
+ message Modification {
+ // The first stop sequence of the original trip that is to be affected by this modification.
+ optional uint32 start_stop_sequence = 1;
+
+ // The number of stops which are canceled and replaced by the replacement_stops. May be zero to indicate no skipped stops.
+ optional uint32 num_stops_replaced = 2;
+
+ // The number of seconds of delay to add to all departure and arrival times following the end of this modification. If multiple modifications apply to the same trip, the delays accumulate as the trip advances.
+ optional int32 propagated_modification_delay = 3 [default = 0];
+
+ // A list of replacement stops, replacing those of the original trip. The length of the new stop times may be less, the same, or greater than the number of replaced stop times.
+ repeated ReplacementStop replacement_stops = 4;
+
+ // The extensions namespace allows 3rd-party developers to extend the
+ // GTFS Realtime Specification in order to add and evaluate new features and
+ // modifications to the spec.
+ extensions 1000 to 1999;
+
+ // The following extension IDs are reserved for private use by any organization.
+ extensions 9000 to 9999;
+ }
+
+ // An arbitrary string to identify this detour. The modifications_id MUST be unique for all currently active detours. The ID of each replacement trip is generated by concatenating modifications_id + '_' + trip_id.
+ required string modifications_id = 1;
+
+ // A list of trips affected by this detour. All trips linked by those trip_ids MUST have the same stop pattern. Two trips have the same stop pattern, if they visit the same stops in the same order, and have identical stop sequences.
+ repeated string trip_ids = 2;
+
+ // Dates on which the detour occurs, in the YYYYMMDD format. Producers SHOULD only transmit detours occurring within the next week.
+ repeated string service_dates = 3;
+
+ // The ID of the new shape for the modified trips. May refer to a new shape added using a GTFS-RT Shape message, or to an existing shape defined in the GTFS-Static feed’s shapes.txt.
+ optional string shape_id = 4;
+
+ // A list of modifications to apply to the affected trips.
+ repeated Modification modifications = 5;
+
+ // The extensions namespace allows 3rd-party developers to extend the
+ // GTFS Realtime Specification in order to add and evaluate new features and
+ // modifications to the spec.
+ extensions 1000 to 1999;
+
+ // The following extension IDs are reserved for private use by any organization.
+ extensions 9000 to 9999;
+}
+
+message ReplacementStop {
+ // The difference in seconds between the arrival time at this stop and the arrival time at the reference stop. The reference stop is the stop prior to start_stop_sequence. If the modification begins at the first stop of the trip, then the first stop of the trip is the reference stop.
+ // This value MUST be monotonically increasing and may only be a negative number if the first stop of the original trip is the reference stop.
+ optional int32 travel_time_to_stop = 1;
+
+ // The replacement stop ID which will now be visited by the trip. May refer to a new stop added using a GTFS-RT Stop message, or to an existing stop defined in the GTFS-Static feed’s stops.txt. The stop MUST have location_type=0 (routable stops).
+ optional string stop_id = 2;
+
+ // The extensions namespace allows 3rd-party developers to extend the
+ // GTFS Realtime Specification in order to add and evaluate new features and
+ // modifications to the spec.
+ extensions 1000 to 1999;
+
+ // The following extension IDs are reserved for private use by any organization.
+ extensions 9000 to 9999;
+}
diff --git a/gtfs-realtime/spec/en/images/first_stop_reference.png b/gtfs-realtime/spec/en/images/first_stop_reference.png
new file mode 100644
index 000000000..188f15b6e
Binary files /dev/null and b/gtfs-realtime/spec/en/images/first_stop_reference.png differ
diff --git a/gtfs-realtime/spec/en/images/propagated_delay.png b/gtfs-realtime/spec/en/images/propagated_delay.png
new file mode 100644
index 000000000..dbdb1646a
Binary files /dev/null and b/gtfs-realtime/spec/en/images/propagated_delay.png differ
diff --git a/gtfs-realtime/spec/en/images/trip_modification.png b/gtfs-realtime/spec/en/images/trip_modification.png
new file mode 100644
index 000000000..188f15b6e
Binary files /dev/null and b/gtfs-realtime/spec/en/images/trip_modification.png differ
diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md
index 4fd4970fb..dbbf1703e 100644
--- a/gtfs-realtime/spec/en/reference.md
+++ b/gtfs-realtime/spec/en/reference.md
@@ -72,6 +72,13 @@ Fields labeled as **experimental** are subject to change and not yet formally ad
* [TranslatedString](#message-translatedstring)
* [Translation](#message-translation)
* [SeverityLevel](#enum-severitylevel)
+ * [Shape](#message-shape)
+ * [Stop](#message-stop)
+ * [WheelchairBoarding](#enum-wheelchairboarding)
+ * [TripModifications](#message-tripmodifications)
+ * [Modification](#message-modification)
+ * [ReplacementStop](#message-replacementstop)
+
# Elements
@@ -556,11 +563,105 @@ A localized image URL mapped to a language.
Describes the physical path that a vehicle takes when the shape is not part of the (CSV) GTFS, such as for an ad-hoc detour. Shapes belong to Trips and consist of an encoded polyline for more efficient transmission. Shapes do not need to intercept the location of Stops exactly, but all Stops on a trip should lie within a small distance of the shape for that trip, i.e. close to straight line segments connecting the shape points
-**Caution:** this message is still **experimental**, and subject to change. It may be formally adopted in the future.
.
+**Fields**
+
+| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
+|------------------|------------|----------------|-------------------|-------------------|
+| **shape_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | Identifier of the shape. Must be different than any `shape_id` defined in the (CSV) GTFS. |
+| **encoded_polyline** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | Encoded polyline representation of the shape. This polyline must contain at least two points. For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm|
+
+## _message_ Stop
+
+Represent a new Stop added to the feed dynamically. All fields are as described in the (CSV) GTFS specification. Location type of the new stop is assumed to be `0` (routable stop).
+
+**Fields**
+
+| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
+|------------------|------------|----------------|-------------------|-------------------|
+| **stop_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Required | One | Identifier of the shape. Must be different than any `stop_id` defined in the (CSV) GTFS. |
+| **stop_code** | [TranslatedString](#message-translatedstring) | Required | One | See definition of [stops.stop_code](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_name** | [TranslatedString](#message-translatedstring) | Optional | One | See definition of [stops.stop_name](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **tts_stop_name** | [TranslatedString](#message-translatedstring) | Optional | One | See definition of [stops.tts_stop_name](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_desc** | [TranslatedString](#message-translatedstring) | Optional | One | See definition of [stops.stop_desc](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_lat** | [float](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.stop_lat](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_lon** | [float](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.stop_lon](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **zone_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.zone_id](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_url** | [TranslatedString](#message-translatedstring) | Optional | One | See definition of [stops.stop_url](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **parent_station** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.parent_station](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **stop_timezone** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.stop_timezone](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **wheelchair_boarding** | [WheelchairBoarding](#enum-wheelchairboarding) | Optional | One | See definition of [stops.wheelchair_boarding](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **level_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | See definition of [stops.level_id](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+| **platform_code** | [TranslatedString](#message-translatedstring) | Optional | One | See definition of [stops.platform_code](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stopstxt) in (CSV) GTFS. |
+
+## _enum_ WheelchairBoarding
+
+**Values**
+
+| _**Value**_ | _**Comment**_ |
+|-------------|---------------|
+| **UNKNOWN** | No accessibility information for the stop. |
+| **AVAILABLE** | Some vehicles at this stop can be boarded by a rider in a wheelchair. |
+| **NOT_AVAILABLE** | Wheelchair boarding is not possible at this stop. |
+
+## _message_ TripModifications
+
+A `TripModifications` message identifies a list of similar `trip_ids` from the (CSV) GTFS sharing the same stop pattern, which are all affected by a particular modification, like a detour. The modification is in effect on all of the listed service_dates, until it is removed from the feed. On any given service date, a trip MUST NOT be assigned to more than one `TripModifications` object.
+
+There MAY be multiple `TripModifications` for a given stop pattern. It may be desirable to split the trips into multiple modifications e.g. if the `propagated_modification_delay` changes significantly, over the course of the detour.
+
+Each affected trip is deemed to be canceled and replaced with a new trip. The affected trip can be omitted from the feed while it is detoured. Each replacement trip has an automatically generated ID and shares all of the properties defined in trips.txt for the affected trip it replaced. Replacement trip IDs can be used in the same way as any other trip_id in GTFS-RT. For example, TripUpdates can be provided using the replacement trip ID.
+
+The stop times of each replacement trip are created from those of the affected trip, by performing the changes listed in modifications. Stop sequences are assigned from 1 to n, ignoring the stop_sequence values of the affected stop times. If a particular stop time is not affected by the detour, all other values will match those originally defined in stop_times.txt.
+
+### SLO: Service-level objective
+The frequency of data updates is expected to be approximately hourly (~24 times/day). Ingestion time may depend on the total number of affected trips. Consumers are expected to ingest a single TripModification within 5 minutes, and a feed with hundreds of detours within 20 minutes.
+
+**Fields**
+
+| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
+|------------------|------------|----------------|-------------------|-------------------|
+| **modifications_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | An arbitrary string to identify this detour. The `modifications_id` MUST be unique for all currently active detours. The ID of each replacement trip is generated by concatenating `modifications_id` + ‘_’ + `trip_id`. |
+| **trip_ids** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | Many | A list of trips_ids from the (CSV) GTFS affected by this detour. All trips linked by those trip_ids MUST have the same stop pattern. Two trips have the same stop pattern, if they visit the same stops in the same order, and have identical stop sequences. If the value `start_times` is set, a maximum of one trip_id can be listed. |
+| **start_times** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | Many | A list of start times in the real-time trip descriptor for the trip_id defined in trip_ids. Useful to target multiple departures of a trip_id in a frequency-based trip. |
+| **service_dates** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | Many | Dates on which the detour occurs, in the YYYYMMDD format. A trip_id will only be modified if it runs on a given service date; the trip IS NOT required to run on all of the service dates. Producers SHOULD only transmit detours occurring within the next week. |
+| **shape_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | The ID of the new shape for the modified trips. May refer to a new shape added using a GTFS-RT Shape message, or to an existing shape defined in the (CSV) GTFS feed’s shapes.txt. |
+| **modifications** | [string](#message-modification) | Required | Many | A list of modifications to apply to the affected trips. |
+
+## _message_ Modification
+
+A `Modification` message replaces a span of n stop times (`num_stops_replaced`) from each affected trip starting at `start_stop_sequence`. The spans of the modifications MUST not overlap. Spans may not be contiguous; in this case the two modifications MUST be merged into one. These stop times are replaced with a new stop time for each replacement stop described by `replacement_stops`.
+
+The sequence of `replacement_stops` may be of arbitrary length. For example, 3 stops could be replaced by 2, 4, or 0 stops as the situation may require.
+
+
+_An example showing the effect of a modification on a particular trip. This modification may also be applied to several other trips._
+
+
+_Propagated detour delays affect all stops following the end of a modification. If a trip has multiple modifications, the delays are accumulated._
+
+
+**Fields**
+
+| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
+|------------------|------------|----------------|-------------------|-------------------|
+| **start_stop_sequence** | [uint32](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | The stop sequence value from the (CSV) GTFS of the first stop of the original trip that is to be affected by this modification. |
+| **num_stops_replaced** | [uint32](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | The number of stops which are canceled and replaced by the `replacement_stops`. May be zero to indicate no skipped stops. |
+| **propagated_modification_delay** | [int32](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | The number of seconds of delay to add to all departure and arrival times following the end of this modification. Can be a positive or negative number. If multiple modifications apply to the same trip, the delays accumulate as the trip advances.
If the value is not supplied, consumers MAY interpolate or infer the `propagated_modification_delay` based on other data. |
+| **replacement_stops** | [ReplacementStop](#message-replacementstop) | Optional | Many | A list of replacement stops, replacing those of the original trip. The length of the new stop times may be less, the same, or greater than the number of replaced stop times. |
+
+## _message_ ReplacementStop
+
+Each `ReplacementStop` message acts as a template for generating a new stop time in each modified trip. The generated stop time will have the specified `stop_id`.
+The `arrival_time` is calculated from a reference stop in the original trip, plus the offset in `travel_time_to_stop`. The `departure_time` always equals the `arrival_time`.
+The optional fields of [`stop_times.txt`](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stop_timestxt) in the (CSV) GTFS specification are all set to their default values.
+
+
+_If a modification affects the first stop of the trip, that stop also serves as the reference stop of the modification._
+
**Fields**
| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
|------------------|------------|----------------|-------------------|-------------------|
-| **shape_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | Identifier of the shape. Must be different than any `shape_id` defined in the (CSV) GTFS.
**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
-| **encoded_polyline** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | Encoded polyline representation of the shape. This polyline must contain at least two points. For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
+| **stop_id** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | The replacement stop ID which will now be visited by the trip. May refer to a new stop added using a GTFS-RT `Stop` message, or to an existing stop defined in the (CSV) GTFS feed’s `stops.txt`. The stop MUST have `location_type=0` (routable stops). |
+| **travel_time_to_stop** | [int32](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | The difference in seconds between the arrival time at this stop and the arrival time at the reference stop. The reference stop is the stop prior to `start_stop_sequence`. If the modification begins at the first stop of the trip, then the first stop of the trip is the reference stop.
This value MUST be monotonically increasing and may only be a negative number if the first stop of the original trip is the reference stop.
If the value is not supplied, consumers MAY interpolate or infer the `travel_time_to_stop` based on other data. |
diff --git a/gtfs/CHANGES.md b/gtfs/CHANGES.md
index c537d1f38..6a4046083 100644
--- a/gtfs/CHANGES.md
+++ b/gtfs/CHANGES.md
@@ -13,7 +13,7 @@ The official specification, reference and documentation are written in English.
- At any point in time the advocate can claim proposal abandoned.
1. The advocate can call for a vote on a version of the proposal at any point in time following the initial 7-day interval required for discussion.
- Before calling for a vote, at least one GTFS producer and one GTFS consumer should implement the proposed change. It is expected that the GTFS producer(s) include the change in a public-facing GTFS feed and provide a link to that data within the pull request comments, and that the GTFS consumer(s) provides a link in the pull request comments to an application that is utilizing the change in a non-trivial manner (i.e, it is supporting new or improved functionality).
-1. Vote lasts the minimum period sufficient to cover 7 full calendar days and 5 full Swiss business days. Vote ends at 23:59:59 UTC.
+1. Vote lasts the minimum period sufficient to cover 14 full calendar days. Vote ends at 23:59:59 UTC.
- The advocate should announce the specific end time at the start of the vote.
- During voting period only editorial changes to the proposal are allowed (typos, wording may change as long as it does not change the meaning).
- Anyone is allowed to vote yes/no in a form of comment to the pull request, and votes can be changed until the end of the voting period.
@@ -53,6 +53,16 @@ Every new feature adds complexity to the creation and reading of feeds. Therefor
### Revision History
+#### August 2023
+* Add fare_media_type=1. See [discussion](https://github.com/google/transit/pull/385).
+
+#### July 2023
+* Forbid subfolders in GTFS files. See [discussion](https://github.com/google/transit/pull/379).
+* Added variable fares by time or day. See [discussion](https://github.com/google/transit/pull/357).
+* Clarify implied timezone in stop_times.txt. See [discussion](https://github.com/google/transit/pull/378).
+* Specify stop times shape_dist_traveled must not exceed the trip shape's maximum distance. See [discussion](https://github.com/google/transit/pull/380).
+* Best practices: add recommended presence. See [discussion](https://github.com/google/transit/pull/386).
+
#### March 14, 2023
* Added fare media. See [discussion](https://github.com/google/transit/pull/355).
diff --git a/gtfs/spec/en/inlining.svg b/gtfs/spec/en/inlining.svg
new file mode 100644
index 000000000..616575da4
--- /dev/null
+++ b/gtfs/spec/en/inlining.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md
index a917e6012..d4a5dbdae 100644
--- a/gtfs/spec/en/reference.md
+++ b/gtfs/spec/en/reference.md
@@ -19,6 +19,7 @@ This document defines the format and structure of the files that comprise a GTFS
- [calendar\_dates.txt](#calendar_datestxt)
- [fare\_attributes.txt](#fare_attributestxt)
- [fare\_rules.txt](#fare_rulestxt)
+ - [timeframes.txt](#timeframestxt)
- [fare\_media.txt](#fare_mediatxt)
- [fare\_products.txt](#fare_productstxt)
- [fare\_leg\_rules.txt](#fare_leg_rulestxt)
@@ -60,6 +61,7 @@ Presence conditions applicable to fields and files:
* **Optional** - The field or file may be omitted from the dataset.
* **Conditionally Required** - The field or file must be included under conditions outlined in the field or file description.
* **Conditionally Forbidden** - The field or file must not be included under conditions outlined in the field or file description.
+* **Recommended** - The field or file may be omitted from the dataset, but it is a best practice to include it. Before omitting this field or file, the best practice should be carefully evaluated and the full implications of omission should be understood.
### Field Types
@@ -76,7 +78,7 @@ Presence conditions applicable to fields and files:
- **Float** - A floating point number.
- **Integer** - An integer.
- **Phone number** - A phone number.
-- **Time** - Time in the HH:MM:SS format (H:MM:SS is also accepted). The time is measured from "noon minus 12h" of the service day (effectively midnight except for days on which daylight savings time changes occur). For times occurring after midnight, enter the time as a value greater than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins.
*Example: `14:30:00` for 2:30PM or `25:35:00` for 1:35AM on the next day.*
+- **Time** - Time in the HH:MM:SS format (H:MM:SS is also accepted). The time is measured from "noon minus 12h" of the service day (effectively midnight except for days on which daylight savings time changes occur). For times occurring after midnight on the service day, enter the time as a value greater than 24:00:00 in HH:MM:SS.
*Example: `14:30:00` for 2:30PM or `25:35:00` for 1:35AM on the next day.*
- **Text** - A string of UTF-8 characters, which is aimed to be displayed and which must therefore be human readable.
- **Timezone** - TZ timezone from the [https://www.iana.org/time-zones](https://www.iana.org/time-zones). Timezone names never contain the space character but may contain an underscore. Refer to [http://en.wikipedia.org/wiki/List\_of\_tz\_zones](http://en.wikipedia.org/wiki/List\_of\_tz\_zones) for a list of valid values.
*Example: `Asia/Tokyo`, `America/Los_Angeles` or `Africa/Cairo`.*
- **URL** - A fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See the following [http://www.w3.org/Addressing/URL/4\_URI\_Recommentations.html](http://www.w3.org/Addressing/URL/4\_URI\_Recommentations.html) for a description of how to create fully qualified URL values.
@@ -110,6 +112,7 @@ This specification defines the following files:
| [calendar_dates.txt](#calendar_datestxt) | **Conditionally Required** | Exceptions for the services defined in the [calendar.txt](#calendartxt).
Conditionally Required:
- **Required** if [calendar.txt](#calendartxt) is omitted. In which case [calendar_dates.txt](#calendar_datestxt) must contain all dates of service.
- Optional otherwise. |
| [fare_attributes.txt](#fare_attributestxt) | Optional | Fare information for a transit agency's routes. |
| [fare_rules.txt](#fare_rulestxt) | Optional | Rules to apply fares for itineraries. |
+| [timeframes.txt](#timeframestxt) | Optional | Date and time periods to use in fare rules for fares that depend on date and time factors. |
| [fare_media.txt](#fare_mediatxt) | Optional | To describe the fare media that can be employed to use fare products.
File [fare_media.txt](#fare_mediatxt) describes concepts that are not represented in [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). As such, the use of [fare_media.txt](#fare_mediatxt) is entirely separate from files [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). |
| [fare_products.txt](#fare_productstxt) | Optional | To describe the different types of tickets or fares that can be purchased by riders.
File [fare_products.txt](#fare_productstxt) describes fare products that are not represented in [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). As such, the use of [fare_products.txt](#fare_productstxt) is entirely separate from files [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). |
| [fare_leg_rules.txt](#fare_leg_rulestxt) | Optional | Fare rules for individual legs of travel.
File [fare_leg_rules.txt](#fare_leg_rulestxt) provides a more detailed method for modeling fare structures. As such, the use of [fare_leg_rules.txt](#fare_leg_rulestxt) is entirely separate from files [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). |
@@ -141,7 +144,7 @@ The following example demonstrates how a field value would appear in a comma-del
* Extra spaces between fields or field names should be removed. Many parsers consider the spaces to be part of the value, which may cause errors.
* Each line must end with a CRLF or LF linebreak character.
* Files should be encoded in UTF-8 to support all Unicode characters. Files that include the Unicode byte-order mark (BOM) character are acceptable. See [http://unicode.org/faq/utf_bom.html#BOM](http://unicode.org/faq/utf_bom.html#BOM) for more information on the BOM character and UTF-8.
-* All dataset files must be zipped together.
+* All dataset files must be zipped together. The files must reside at the root level directly, not in a subfolder.
## Field Definitions
@@ -153,7 +156,7 @@ Primary key (`agency_id`)
| Field Name | Type | Presence | Description |
| ------ | ------ | ------ | ------ |
-| `agency_id` | Unique ID | **Conditionally Required** | Identifies a transit brand which is often synonymous with a transit agency. Note that in some cases, such as when a single agency operates multiple separate services, agencies and brands are distinct. This document uses the term "agency" in place of "brand". A dataset may contain data from multiple agencies.
Conditionally Required:
- **Required** when the dataset contains data for multiple transit agencies.
- Optional otherwise. |
+| `agency_id` | Unique ID | **Conditionally Required** | Identifies a transit brand which is often synonymous with a transit agency. Note that in some cases, such as when a single agency operates multiple separate services, agencies and brands are distinct. This document uses the term "agency" in place of "brand". A dataset may contain data from multiple agencies.
Conditionally Required:
- **Required** when the dataset contains data for multiple transit agencies.
- Recommended otherwise. |
| `agency_name` | Text | **Required** | Full name of the transit agency. |
| `agency_url` | URL | **Required** | URL of the transit agency. |
| `agency_timezone` | Timezone | **Required** | Timezone where the transit agency is located. If multiple agencies are specified in the dataset, each must have the same `agency_timezone`. |
@@ -196,8 +199,8 @@ Primary key (`route_id`)
| Field Name | Type | Presence | Description |
| ------ | ------ | ------ | ------ |
| `route_id` | Unique ID | **Required** | Identifies a route. |
-| `agency_id` | Foreign ID referencing `agency.agency_id` | **Conditionally Required** | Agency for the specified route.
Conditionally Required:
- **Required** if multiple agencies are defined in [agency.txt](#agency).
- Optional otherwise. |
-| `route_short_name` | Text | **Conditionally Required** | Short name of a route. Often a short, abstract identifier (e.g., "32", "100X", "Green") that riders use to identify a route. Both `route_short_name` and `route_long_name` may be defined.
Conditionally Required:
- **Required** if `routes.route_long_name` is empty.
- Optional otherwise. |
+| `agency_id` | Foreign ID referencing `agency.agency_id` | **Conditionally Required** | Agency for the specified route.
Conditionally Required:
- **Required** if multiple agencies are defined in [agency.txt](#agency).
- Recommended otherwise. |
+| `route_short_name` | Text | **Conditionally Required** | Short name of a route. Often a short, abstract identifier (e.g., "32", "100X", "Green") that riders use to identify a route. Both `route_short_name` and `route_long_name` may be defined.
Conditionally Required:
- **Required** if `routes.route_long_name` is empty.
- Recommended if there is a brief service designation. This should be the commonly-known passenger name of the service, and should be no longer than 12 characters. |
| `route_long_name` | Text | **Conditionally Required** | Full name of a route. This name is generally more descriptive than the `route_short_name` and often includes the route's destination or stop. Both `route_short_name` and `route_long_name` may be defined.
Conditionally Required:
- **Required** if `routes.route_short_name` is empty.
- Optional otherwise. |
| `route_desc` | Text | Optional | Description of a route that provides useful, quality information. Should not be a duplicate of `route_short_name` or `route_long_name`.