Skip to content

Commit 0ab5d15

Browse files
committed
Trip modifications clarifications
- Specify that the shape should be the full shape - Clarification on usage of ids inside a GTFS-rt - Clarification that linked entities should be done inside the same feed - Sync definition of shape_id inside TripProperties between proto and reference
1 parent be86127 commit 0ab5d15

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

gtfs-realtime/proto/gtfs-realtime.proto

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,12 @@ message TripUpdate {
374374
// populated and will be ignored by consumers.
375375
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
376376
optional string start_time = 3;
377-
// Specifies the shape of the vehicle travel path when the trip shape differs from the shape specified in
378-
// (CSV) GTFS or to specify it in real-time when it's not provided by (CSV) GTFS, such as a vehicle that takes differing
379-
// paths based on rider demand. See definition of trips.shape_id in (CSV) GTFS. If a shape is neither defined in (CSV) GTFS
380-
// nor in real-time, the shape is considered unknown. This field can refer to a shape defined in the (CSV) GTFS in shapes.txt
381-
// or a Shape in the (protobuf) real-time feed. The order of stops (stop sequences) for this trip must remain the same as
382-
// (CSV) GTFS. Stops that are a part of the original trip but will no longer be made, such as when a detour occurs, should
383-
// be marked as schedule_relationship=SKIPPED.
377+
// Specifies the identifier of the shape of the vehicle travel path when the trip shape differs from the shape specified in (CSV) GTFS
378+
// or to specify it in real-time when it's not provided by (CSV) GTFS, such as a vehicle that takes differing paths based on rider demand. See definition of trips.shape_id in (CSV) GTFS.
379+
// If a shape is neither defined in (CSV) GTFS nor in real-time, the shape is considered unknown. This field can refer to a shape defined in the (CSV) GTFS in shapes.txt or a `Shape` in the same (protobuf) real-time feed.
380+
// The order of stops (stop sequences) for this trip must remain the same as (CSV) GTFS.
381+
// If it refers to a `Shape` entity in the same real-time feed, the value of this field should be the one of the `shape_id` inside the entity, and _not_ the `id` of `FeedEntity`.
382+
// Stops that are a part of the original trip but will no longer be made, such as when a detour occurs, should be marked as schedule_relationship=SKIPPED or more details can be provided via a `TripModifications` message.
384383
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
385384
optional string shape_id = 4;
386385

@@ -1051,7 +1050,7 @@ message Shape {
10511050
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
10521051
optional string shape_id = 1;
10531052

1054-
// Encoded polyline representation of the shape. This polyline must contain at least two points.
1053+
// Encoded polyline representation of the shape. This polyline must contain at least two points and represent the full shape of the trip where it's used.
10551054
// For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
10561055
// This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
10571056
// See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
@@ -1141,8 +1140,9 @@ message TripModifications {
11411140
message SelectedTrips {
11421141
// A list of trips affected with this replacement that all have the same new `shape_id`.
11431142
repeated string trip_ids = 1;
1144-
// The ID of the new shape for the modified trips in this SelectedTrips.
1145-
// 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.
1143+
// The ID of the new shape for the modified trips in this SelectedTrips.
1144+
// May refer to a new shape added using a `Shape` message in the same gtfs-rt feed, or to an existing shape defined in the GTFS-Static feed’s shapes.txt.
1145+
// If it refers to a `Shape` entity in the real-time feed, the value of this field should be the one of the `shape_id` inside the entity, and _not_ the `id` of `FeedEntity`.
11461146
optional string shape_id = 2;
11471147

11481148
// The extensions namespace allows 3rd-party developers to extend the
@@ -1200,7 +1200,8 @@ message ReplacementStop {
12001200
// 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.
12011201
optional int32 travel_time_to_stop = 1;
12021202

1203-
// 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).
1203+
// 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 in the same gtfs-rt feed, or to an existing stop defined in the (CSV) GTFS feed’s `stops.txt`.
1204+
// If it refers to a `Shape` entity in the real-time feed, the value of this field should be the one of the `stop_id` inside the entity, and _not_ the `id` of `FeedEntity`. The replacement stop MUST have `location_type=0` (routable stops).
12041205
optional string stop_id = 2;
12051206

12061207
// The extensions namespace allows 3rd-party developers to extend the

gtfs-realtime/spec/en/reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ Defines updated properties of the trip
244244
| **trip_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Conditionally required | One | Defines the identifier of a new trip that is a duplicate of an existing trip defined in (CSV) GTFS trips.txt but will start at a different service date and/or time (defined using `TripProperties.start_date` and `TripProperties.start_time`). See definition of `trips.trip_id` in (CSV) GTFS. Its value must be different than the ones used in the (CSV) GTFS. This field is required if `schedule_relationship` is `DUPLICATED`, otherwise this field must not be populated and will be ignored by consumers. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
245245
| **start_date** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Conditionally required | One | Service date on which the duplicated trip will be run. Must be provided in YYYYMMDD format. This field is required if `schedule_relationship` is `DUPLICATED`, otherwise this field must not be populated and will be ignored by consumers. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
246246
| **start_time** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Conditionally required | One | Defines the departure start time of the trip when it’s duplicated. See definition of `stop_times.departure_time` in (CSV) GTFS. Scheduled arrival and departure times for the duplicated trip are calculated based on the offset between the original trip `departure_time` and this field. For example, if a GTFS trip has stop A with a `departure_time` of `10:00:00` and stop B with `departure_time` of `10:01:00`, and this field is populated with the value of `10:30:00`, stop B on the duplicated trip will have a scheduled `departure_time` of `10:31:00`. Real-time prediction `delay` values are applied to this calculated schedule time to determine the predicted time. For example, if a departure `delay` of `30` is provided for stop B, then the predicted departure time is `10:31:30`. Real-time prediction `time` values do not have any offset applied to them and indicate the predicted time as provided. For example, if a departure `time` representing 10:31:30 is provided for stop B, then the predicted departure time is `10:31:30`.This field is required if `schedule_relationship` is `DUPLICATED`, otherwise this field must not be populated and will be ignored by consumers. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
247-
| **shape_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the shape of the vehicle travel path for this trip when it differs from the original. Refers to a shape defined in the (CSV) GTFS or a new shape entity in a real-time feed. See definition of `trips.shape_id` in (CSV) GTFS. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
247+
| **shape_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the identifier of the shape of the vehicle travel path when the trip shape differs from the shape specified in (CSV) GTFS or to specify it in real-time when it's not provided by (CSV) GTFS, such as a vehicle that takes differing paths based on rider demand. See definition of `trips.shape_id` in (CSV) GTFS. <br>If a shape is neither defined in (CSV) GTFS nor in real-time, the shape is considered unknown. This field can refer to a shape defined in the (CSV) GTFS in shapes.txt or a `Shape` in the same (protobuf) real-time feed. The order of stops (stop sequences) for this trip must remain the same as (CSV) GTFS. If it refers to a `Shape` entity in the same real-time feed, the value of this field should be the one of the `shape_id` inside the entity, and _not_ the `id` of `FeedEntity`.<br>Stops that are a part of the original trip but will no longer be made, such as when a detour occurs, should be marked as schedule_relationship=SKIPPED or more details can be provided via a `TripModifications` message. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
248248

249249
## _message_ VehiclePosition
250250

@@ -589,7 +589,7 @@ Describes the physical path that a vehicle takes when the shape is not part of t
589589
| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
590590
|------------------|------------|----------------|-------------------|-------------------|
591591
| **shape_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Required | One | Identifier of the shape. Must be different than any `shape_id` defined in the (CSV) GTFS. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
592-
| **encoded_polyline** | [string](https://protobuf.dev/programming-guides/proto2/#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 <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
592+
| **encoded_polyline** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Required | One | Encoded polyline representation of the shape. This polyline must contain at least two points and represent the full shape of the trip where it's used. For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |
593593

594594
## _message_ Stop
595595

@@ -691,7 +691,7 @@ List of selected trips with an associated shape.
691691
| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
692692
|------------------|------------|----------------|-------------------|-------------------|
693693
| **trip_ids** | [uint32](https://protobuf.dev/programming-guides/proto2/#scalar) | Many | One | A list of trip_id from the original (CSV) GTFS that are affected by the containing replacement. Need to contain at least one trip_id. |
694-
| **shape_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Required | One | The ID of the new shape for the modified trips in this SelectedTrips. 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. |
694+
| **shape_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Required | One | The ID of the new shape for the modified trips in this SelectedTrips. May refer to a new shape added using a `Shape` message in the same gtfs-rt feed, or to an existing shape defined in the GTFS-Static feed’s shapes.txt. If it refers to a `Shape` entity in the real-time feed, the value of this field should be the one of the `shape_id` inside the entity, and _not_ the `id` of `FeedEntity`. |
695695

696696
## _message_ ReplacementStop
697697

@@ -707,5 +707,5 @@ _If a modification affects the first stop of the trip, that stop also serves as
707707

708708
| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
709709
|------------------|------------|----------------|-------------------|-------------------|
710-
| **stop_id** | [string](https://protobuf.dev/programming-guides/proto2/#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). |
710+
| **stop_id** | [string](https://protobuf.dev/programming-guides/proto2/#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 in the same gtfs-rt feed, or to an existing stop defined in the (CSV) GTFS feed’s `stops.txt`. If it refers to a `Shape` entity in the real-time feed, the value of this field should be the one of the `stop_id` inside the entity, and _not_ the `id` of `FeedEntity`. The stop MUST have `location_type=0` (routable stops). |
711711
| **travel_time_to_stop** | [int32](https://protobuf.dev/programming-guides/proto2/#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_selector`. If the modification begins at the first stop of the trip, then the first stop of the trip is the reference stop. <br/><br/>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. <br/><br/>If the value is not supplied, consumers MAY interpolate or infer the `travel_time_to_stop` based on other data. |

0 commit comments

Comments
 (0)