From f28c2820de291ed6d4fc102b4c066bd6dfb329c3 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Wed, 16 Jul 2025 13:11:22 +0100 Subject: [PATCH 1/3] add trip_route_type into GTFS static --- gtfs/spec/en/reference.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index 7d1a915d..d48a8007 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -254,6 +254,7 @@ Primary key (`trip_id`) | `route_id` | Foreign ID referencing `routes.route_id` | **Required** | Identifies a route. | | `service_id` | Foreign ID referencing `calendar.service_id` or `calendar_dates.service_id` | **Required** | Identifies a set of dates when service is available for one or more routes. | | `trip_id` | Unique ID | **Required** | Identifies a trip. | +| `trip_route_type` | Enum | **Optional** | Identifies the type of transportation of the trip if it is not the same as the route. See the definition of `route_type` in [routes.txt](#routestxt) for the values. | | `trip_headsign` | Text | Optional | Text that appears on signage identifying the trip's destination to riders. This field is recommended for all services with headsign text displayed on the vehicle which may be used to distinguish amongst trips in a route.

If the headsign changes during a trip, values for `trip_headsign` may be overridden by defining values in `stop_times.stop_headsign` for specific `stop_time`s along the trip. | | `trip_short_name` | Text | Optional | Public facing text used to identify the trip to riders, for instance, to identify train numbers for commuter rail trips. If riders do not commonly rely on trip names, `trip_short_name` should be empty. A `trip_short_name` value, if provided, should uniquely identify a trip within a service day; it should not be used for destination names or limited/express designations. | | `direction_id` | Enum | Optional | Indicates the direction of travel for a trip. This field should not be used in routing; it provides a way to separate trips by direction when publishing time tables. Valid options are:

`0` - Travel in one direction (e.g. outbound travel).
`1` - Travel in the opposite direction (e.g. inbound travel).
*Example: The `trip_headsign` and `direction_id` fields may be used together to assign a name to travel in each direction for a set of trips. A [trips.txt](#tripstxt) file could contain these records for use in time tables:*
`trip_id,...,trip_headsign,direction_id`
`1234,...,Airport,0`
`1505,...,Downtown,1` | From 2be9a2895fda0a0b23ac0e993bb4bd48a12063f1 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Wed, 16 Jul 2025 13:32:21 +0100 Subject: [PATCH 2/3] add trip_route_type into GTFS Realtime --- gtfs-realtime/proto/gtfs-realtime.proto | 17 +++++++++++++++++ gtfs-realtime/spec/en/reference.md | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/gtfs-realtime/proto/gtfs-realtime.proto b/gtfs-realtime/proto/gtfs-realtime.proto index e050fc19..435500ae 100644 --- a/gtfs-realtime/proto/gtfs-realtime.proto +++ b/gtfs-realtime/proto/gtfs-realtime.proto @@ -424,6 +424,10 @@ message TripUpdate { // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. optional string trip_short_name = 6; + // Specifies the type of transportation for this trip when it differs from the original. + // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. + optional RouteType trip_route_type = 7; + // 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. @@ -443,6 +447,19 @@ message TripUpdate { extensions 9000 to 9999; } +enum RouteType { + TRAM = 0; + METRO = 1; + RAIL = 2; + BUS = 3; + FERRY = 4; + CABLE_TRAM = 5; + AERIAL_LIFT = 6; + FUNICULAR = 7; + TROLLEYBUS = 11; + MONORAIL = 12; +} + // Realtime positioning information for a given vehicle. message VehiclePosition { // The Trip that this vehicle is serving. diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md index 1c4b96dc..f614f853 100644 --- a/gtfs-realtime/spec/en/reference.md +++ b/gtfs-realtime/spec/en/reference.md @@ -267,6 +267,24 @@ Defines updated properties of the trip | **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.
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`.
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.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | | **trip_headsign** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the headsign for this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | | **trip_short_name** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the name for this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | +| **trip_route_type** | [RouteType](#enum-RouteType) | Optional | One | Specifies the type of transportation of this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | + +## _enum_ RouteType + +**Values** + +| _**Value**_ | _**Comment**_ | +|-------------|---------------| +| **TRAM** | Tram, Streetcar, Light Rail. See definition of routes.route_type=0 in (CSV) GTFS. | +| **METRO** | Subway, Metro. See definition of routes.route_type=1 in (CSV) GTFS. | +| **RAIL** | Rail. See definition of routes.route_type=2 in (CSV) GTFS. | +| **BUS** | Bus. See definition of routes.route_type=3 in (CSV) GTFS. | +| **FERRY** | Ferry. See definition of routes.route_type=4 in (CSV) GTFS. | +| **CABLE_TRAM** | Cable tram. See definition of routes.route_type=5 in (CSV) GTFS. | +| **AERIAL_LIFT** | Aerial lift. See definition of routes.route_type=6 in (CSV) GTFS. | +| **FUNICULAR** | Funicular. See definition of routes.route_type=7 in (CSV) GTFS. | +| **TROLLEYBUS** | Trolleybus. See definition of routes.route_type=11 in (CSV) GTFS. | +| **MONORAIL** | Monorail. See definition of routes.route_type=12 in (CSV) GTFS. | ## _message_ VehiclePosition From de34251a03d26927f7bb510fdc8ba4e87a4d5fa7 Mon Sep 17 00:00:00 2001 From: Michael Tsang Date: Wed, 16 Jul 2025 15:25:03 +0100 Subject: [PATCH 3/3] Revert "add trip_route_type into GTFS Realtime" This reverts commit 2be9a2895fda0a0b23ac0e993bb4bd48a12063f1. --- gtfs-realtime/proto/gtfs-realtime.proto | 17 ----------------- gtfs-realtime/spec/en/reference.md | 18 ------------------ 2 files changed, 35 deletions(-) diff --git a/gtfs-realtime/proto/gtfs-realtime.proto b/gtfs-realtime/proto/gtfs-realtime.proto index 435500ae..e050fc19 100644 --- a/gtfs-realtime/proto/gtfs-realtime.proto +++ b/gtfs-realtime/proto/gtfs-realtime.proto @@ -424,10 +424,6 @@ message TripUpdate { // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. optional string trip_short_name = 6; - // Specifies the type of transportation for this trip when it differs from the original. - // NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. - optional RouteType trip_route_type = 7; - // 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. @@ -447,19 +443,6 @@ message TripUpdate { extensions 9000 to 9999; } -enum RouteType { - TRAM = 0; - METRO = 1; - RAIL = 2; - BUS = 3; - FERRY = 4; - CABLE_TRAM = 5; - AERIAL_LIFT = 6; - FUNICULAR = 7; - TROLLEYBUS = 11; - MONORAIL = 12; -} - // Realtime positioning information for a given vehicle. message VehiclePosition { // The Trip that this vehicle is serving. diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md index f614f853..1c4b96dc 100644 --- a/gtfs-realtime/spec/en/reference.md +++ b/gtfs-realtime/spec/en/reference.md @@ -267,24 +267,6 @@ Defines updated properties of the trip | **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.
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`.
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.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | | **trip_headsign** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the headsign for this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | | **trip_short_name** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Specifies the name for this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | -| **trip_route_type** | [RouteType](#enum-RouteType) | Optional | One | Specifies the type of transportation of this trip when it differs from the original.

**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. | - -## _enum_ RouteType - -**Values** - -| _**Value**_ | _**Comment**_ | -|-------------|---------------| -| **TRAM** | Tram, Streetcar, Light Rail. See definition of routes.route_type=0 in (CSV) GTFS. | -| **METRO** | Subway, Metro. See definition of routes.route_type=1 in (CSV) GTFS. | -| **RAIL** | Rail. See definition of routes.route_type=2 in (CSV) GTFS. | -| **BUS** | Bus. See definition of routes.route_type=3 in (CSV) GTFS. | -| **FERRY** | Ferry. See definition of routes.route_type=4 in (CSV) GTFS. | -| **CABLE_TRAM** | Cable tram. See definition of routes.route_type=5 in (CSV) GTFS. | -| **AERIAL_LIFT** | Aerial lift. See definition of routes.route_type=6 in (CSV) GTFS. | -| **FUNICULAR** | Funicular. See definition of routes.route_type=7 in (CSV) GTFS. | -| **TROLLEYBUS** | Trolleybus. See definition of routes.route_type=11 in (CSV) GTFS. | -| **MONORAIL** | Monorail. See definition of routes.route_type=12 in (CSV) GTFS. | ## _message_ VehiclePosition