Skip to content

Add GTFS extended route_types#279

Closed
naxxfish wants to merge 2 commits intogoogle:masterfrom
naxxfish:gtfs-extended-route-types
Closed

Add GTFS extended route_types#279
naxxfish wants to merge 2 commits intogoogle:masterfrom
naxxfish:gtfs-extended-route-types

Conversation

@naxxfish
Copy link

@google-cla
Copy link

google-cla bot commented Jul 21, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Jul 21, 2021
@gcamp
Copy link
Contributor

gcamp commented Jul 21, 2021

Can you explain a bit how those all route types would be useful? There's a lot of service that I don't see being used in GTFS ever.

@naxxfish
Copy link
Author

naxxfish commented Jul 21, 2021

The Google proposal does provide examples for many of the route types, derived from this (now defunct) BBC page, which in of itself was proposed by TPEG.

They are being used by producers, e.g. 109 in VBB in Germany to represent Suburban Railways, or in 700 in Timetable Feed for NSW
Buses
to represent busses.

The original list was derived from the TPEG specification and has been pared down since then. It could be reduced further (to remove more unusual types like "Post Bus Service" or "Aerial Lift Service", however by doing so there would be holes in the sequence which may increase confusion. Renumbering the list would risk overloading existing interpretations of the route_types.

Since the proposed extension has been publically available for so long, and datasets have been built that use them, despite the fact that the meaning of these types are relatively well known and supported in many consumers (e.g. Google Transit and , GTFS produced using these values fails validation in many implementations of validators as it is not part of the reference specification.

@google-cla
Copy link

google-cla bot commented Jul 21, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

| `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.<br><br>Conditionally Required:<br>- **Required** if `routes.route_short_name` is empty.<br>- Optional otherwise. |
| `route_desc` | Text | Optional | Description of a route that provides useful, quality information. Do not simply duplicate the name of the route. <hr> _Example: "A" trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue, Queens at all times. Also from about 6AM until about midnight, additional "A" trains operate between Inwood-207 St and Lefferts Boulevard (trains typically alternate between Lefferts Blvd and Far Rockaway)._ |
| `route_type` | Enum | **Required** | Indicates the type of transportation used on a route. Valid options are: <br><br>`0` - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.<br>`1` - Subway, Metro. Any underground rail system within a metropolitan area.<br>`2` - Rail. Used for intercity or long-distance travel.<br>`3` - Bus. Used for short- and long-distance bus routes.<br>`4` - Ferry. Used for short- and long-distance boat service.<br>`5` - Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle (e.g., cable car in San Francisco).<br>`6` - Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables.<br>`7` - Funicular. Any rail system designed for steep inclines.<br>`11` - Trolleybus. Electric buses that draw power from overhead wires using poles.<br>`12` - Monorail. Railway in which the track consists of a single rail or a beam. <br><br>In addition, an extension has been proposed to allow specifying route types using Hierarchical Vehicle Type (HVT) codes from the European TPEG standard. <br><br>`100` - Railway Service<br>`101` - High Speed Rail Service<br>`102` - Long Distance Trains<br>`103` - Inter Regional ail Service<br>`104` - Car Transport Rail Service<br>`105` - Sleeper Rail Service<br>`106` - Regional Rail ervice<br>`107` - Tourist Railway Service<br>`108` - Rail Shuttle (Within Complex)<br>`109` - Suburban Railway<br>`110` - Replacement Rail Service<br>`111` - Special Rail Service<br>`112` - Lorry Transport Rail ervice<br>`113` - All Rail Services<br>`114` - Cross-Country Rail Service<br>`115` - Vehicle Transport Rail ervice<br>`116` - Rack and Pinion Railway<br>`117` - Additional Rail Service<br>`200` - Coach Service<br>`201` - International Coach Service<br>`202` - National Coach Service<br>`203` - Shuttle Coach Service<br>`204` - egional Coach Service<br>`205` - Special Coach Service<br>`206` - Sightseeing Coach Service<br>`207` - Tourist oach Service<br>`208` - Commuter Coach Service<br>`209` - All Coach Services<br>`400` - Urban Railway Service<br>`401` - Metro Service<br>`402` - Underground Service<br>`403` - Urban Railway Service<br>`404` - All rban Railway Services<br>`405` - Monorail<br>`700` - Bus Service<br>`701` - Regional Bus Service<br>`702` - xpress Bus Service<br>`703` - Stopping Bus Service<br>`704` - Local Bus Service<br>`705` - Night Bus Service<br>`706` - Post Bus Service<br>`707` - Special Needs Bus<br>`708` - Mobility Bus Service<br>`709` - - Mobility Bus for Registered Disabled <br>`710` - Sightseeing Bus<br>`711` - Shuttle Bus<br>`712` - School us<br>`713` - School and Public Service Bus<br>`714` - Rail Replacement Bus Service<br>`715` - Demand and esponse Bus Service<br>`716` - All Bus Services<br>`800` - Trolleybus Service<br>`900` - Tram Service<br>`901` - City Tram Service<br>`902` - Local Tram Service<br>`903` - Regional Tram Service<br>`904` - Sightseeing Tram ervice<br>`905` - Shuttle Tram Service<br>`906` - All Tram Services<br>`1000` - Water Transport Service<br>`1100` - Air Service<br>`1200` - Ferry Service<br>`1300` - Aerial Lift Service<br>`1400` - Funicular ervice<br>`1500` - Taxi Service<br>`1501` - Communal Taxi Service<br>`1502` - Water Taxi Service<br>`1503` - ail Taxi Service<br>`1504` - Bike Taxi Service<br>`1505` - Licensed Taxi Service<br>`1506` - Private Hire ervice Vehicle<br>`1507` - All Taxi Services <br>`1700` - Miscellaneous Service<br>`1702` - Horse-drawn Carriage|
| `route_type` | Enum | **Required** | Indicates the type of transportation used on a route. Valid options are: <br><br>`0` - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.<br>`1` - Subway, Metro. Any underground rail system within a metropolitan area.<br>`2` - Rail. Used for intercity or long-distance travel.<br>`3` - Bus. Used for short- and long-distance bus routes.<br>`4` - Ferry. Used for short- and long-distance boat service.<br>`5` - Cable tram. Used for street-level rail cars where the cable runs beneath the vehicle (e.g., cable car in San Francisco).<br>`6` - Aerial lift, suspended cable car (e.g., gondola lift, aerial tramway). Cable transport where cabins, cars, gondolas or open chairs are suspended by means of one or more cables.<br>`7` - Funicular. Any rail system designed for steep inclines.<br>`11` - Trolleybus. Electric buses that draw power from overhead wires using poles.<br>`12` - Monorail. Railway in which the track consists of a single rail or a beam. <br><br>In addition, an extension has been proposed to allow specifying several route types using a relevant subset of Hierarchical Vehicle Type (HVT) codes from the European TPEG standard. <br><br>`100` - Railway Service<br>`101` - High Speed Rail Service<br>`102` - Long Distance Trains<br>`103` - Inter Regional ail Service<br>`105` - Sleeper Rail Service<br>`106` - Regional Rail ervice<br>`107` - Tourist Railway Service<br>`108` - Rail Shuttle (Within Complex)<br>`109` - Suburban Railway<br>`200` - Coach Service<br>`201` - International Coach Service<br>`202` - National Coach Service<br>`204` - Regional Coach Service<br>`400` - Urban Railway Service<br>`401` - Metro Service<br>`402` - Underground Service<br>`403` - Urban Railway Service<br>`405` - Monorail<br>`700` - Bus Service<br>`701` - Regional Bus Service<br>`702` - Express Bus Service<br>`704` - Local Bus Service<br>`715` - Demand and Response Bus Service<br>`800` - Trolleybus Service<br>`900` - Tram Service<br>`901` - City Tram Service<br>`902` - Local Tram Service<br>`903` - Regional Tram Service<br>`904` - Sightseeing Tram ervice<br>`905` - Shuttle Tram Service<br>`906` - All Tram Services<br>`1000` - Water Transport Service<br>`1200` - Ferry Service<br>`1300` - Aerial Lift Service<br>`1400` - Funicular Service<br>`1501` - Communal Taxi Service<br>`1700` - Miscellaneous Service<br>`1702` - Horse-drawn Carriage|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't support these kind of changes. Google Maps is not the exclusive user of these datasets.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From cursorary observation of a small sample of datasets, these seem to be the more popular ones.

Very happy to revert that commit if these (official but unofficial) extensions are actually in use in the real world.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say, these values should be update to recent TPEG changes, and then use all the TPEG values. It is a hierarchy anyway.

Copy link
Author

@naxxfish naxxfish Jul 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's desirable to synchronise with TPEG2-PTS (TS 21219-13:2020), that seems like a logical course of action. However, I don't personally have access to this specification (it comes at a cost of 178 CHF from the ISO webshop or £260 from the BSI webshop) to know the new values, and as far as I know they aren't publically available in isolation from the standard anywhere. I'm also unsure on the terms of the copyright for that standard and whether it'd be permissible to replicate a part of it in the GTFS specification.

Also, it may not be desirable to simply replicate the TPEG standard list of vehicle types, but actually only a subsection of it that is likely to be useful for data export in GTFS format. The intended uses of the two are different - TPEG is primarily interested in transmission of transport related information for immediate consumer use (e.g. traffic alerts in DAB radios, where it originated) - rather than describing a schedule or changes to it. The types of vehicle represented may not all be relevant to GTFS.

Then again, transit providers may already have systems which use the TPEG codes for use in different areas (e.g. issuing service alerts to broadcasters), so making the two instantly compatible may be beneficial.

Hard for me to know from my viewpoint! Would welcome thoughts from others.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think SIRI should be / is going to be updated. Already with a limited scope.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SIRI modes for the most part seem to be compatible here. The only difference is they don't have numeric values (they've just enums) - so in order to preserve compatibility with providers implementing the defacto Google extension, the original numbers would need to be preserved and any additions to be assigned new numbers.

@skinkie
Copy link
Contributor

skinkie commented Jul 21, 2021

Can you explain a bit how those all route types would be useful? There's a lot of service that I don't see being used in GTFS ever.

Also in Swiss data this exists. Specifically differentiation between rail modes are very prominent.

@sccmcca
Copy link
Contributor

sccmcca commented Aug 2, 2021

If I may reference @aababilov's (@ Google) thoughts on this matter from #174:

I find extended route types dreadful. Many of them are unclearly defined (say, what is the difference between metro and underground?!) and many types are simply missing there (no way to tell between tram and light rail etc). I am supporting the GTFS-Modes proposal which gives the full flexibility to data providers and consumers (http://bit.ly/gtfs-modes-and-networks). I would like to keep the list of route_types short and dense.

As mentioned, the GTFS-ModesAndNetworks proposal may be a favorable solution as it allows distinction between what a mode is locally called and a stable wikidata identifier describing what it is. This avoids the exhaustive listing proposed in this PR.

@abyrd
Copy link

abyrd commented Aug 20, 2021

A few observations:

  • Although TPEG codes are regularly encountered "in the wild" and are used by Google, as far as I know this was never officially adopted as an extension. It is reasonable to expect producers and consumers employing an unofficial extension to adapt their data when the functionality is finalized through an official process.
  • It may be problematic to officially embed a non-open standard (TPEG) inside an open one (GTFS). Are we certain that there are no legal constraints on embedding even a pared down form of an early draft?
  • If there are no legal concerns, a subset of TPEG codes is convenient because like the existing route_type field they are numbers, they are hierarchical, and some feeds already use them.
  • It is very useful that the codes are hierarchical. This allows GTFS producers to micro-categorize their routes if desired, while making it straightforward for GTFS consumers to collapse these down into 10 or so high level categories.
  • With such a hierarchical code system, it's more or less harmless to have some unused or ill-defined modes.

Placing the entire list of modes inline in the description of route_type is quite verbose and puts them on par with the original 7 modes. Even if extended mode codes are adopted, I think there is still a clear hierarchy: the original 7 modes are very widely used and much more likely to be handled exhaustively by consumers; the many additional codes are clearly an extension, and consumers are very likely to handle them by mapping them down to a smaller set, or handle a few as special cases. (Some of the original modes like "cable car" might also get second-class support, but the core idea remains.) The reference for all available mode codes should probably be pulled out into a separate section and referenced from the route_type description.

It is somewhat appealing to just scrap any exhaustive list of codes, and make modes and networks fully producer-defined as suggested by @scmcca. The GTFS-ModesAndNetworks proposal looks promising, but it might benefit from a few revisions. For example, it seems like producers would be required to define a route_type on every route even when they have also defined a mode. I'm also unclear on why the modes would be tied to an ID in a predetermined database (mobilitydatabase.org or wikidata), as opposed to a URL. URLs are used elsewhere in GTFS, and are themselves globally unique IDs.

@sccmcca sccmcca added the GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule label Aug 30, 2021
@stale
Copy link

stale bot commented Oct 2, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issues and Pull Requests that have remained inactive for 30 calendar days or more. label Oct 2, 2021
@github-actions
Copy link

This pull request has been closed due to inactivity. Pull requests can always be reopened after they have been closed. See the Specification Amendment Process.

@github-actions github-actions bot closed this Nov 19, 2021
@skinkie
Copy link
Contributor

skinkie commented Nov 19, 2021

Keep open.

@sccmcca
Copy link
Contributor

sccmcca commented Nov 22, 2021

@skinkie As defined in article 8 of the Specification Amendment Process, it is up to the advocate (@naxxfish) if they wish to continue the proposal.

Article 8 reads:

Any pull request remaining inactive for 30 calendar days will be closed. When a pull request is closed, the corresponding proposal is considered abandoned. The advocate may reopen the pull request at any time if they wish to continue or maintain the conversation.

If you have a counter proposal or wish to advocate this PR yourself, I think this would be easiest done by opening a separate one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule Status: Stale Issues and Pull Requests that have remained inactive for 30 calendar days or more.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants