Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More useful short names for rail routes in UK #886

Open
dodoradio opened this issue Feb 12, 2025 · 10 comments
Open

More useful short names for rail routes in UK #886

dodoradio opened this issue Feb 12, 2025 · 10 comments
Labels
enhancement New feature or request motis changes to the MOTIS routing engine are necessary

Comments

@dodoradio
Copy link

Currently all rail routes in UK have 'routeShortName' as some sort of rail route code. Examples:

  • VT719000 represents the 18:13 Avanti West Coast train from London Euston to Manchester Piccadilly
  • LE502300 represents the 18:10 Greater Anglia Stansted Express train from London Liverpool Street to Stansted Airport
  • LO605500 represents the 18:09 London Overground Suffragette line train from Gospel Oak to Barking Riverside

The codes aren't very easy to read or correlate with anything else, and some of these services have more appropriate names. People in the UK generally refer to trains by the operator and time (eg. 18:13 Avanti West Coast from xyz to pqr), so there's not really an elegant existing solution. Some routes have additional branding, e.g. 'Stansted Express' operated by 'Greater Anglia', or the 'Suffragette line' of the 'London Overground'. This should be in the route short name. However, in other cases it might be appropriate to put the operator as a more useful reference than the code.

@Altonss
Copy link
Collaborator

Altonss commented Feb 12, 2025

Related to #759
Displaying the operator name for UK train services would make sense (Google Maps seems to be doing the same).

@Altonss Altonss added the enhancement New feature or request label Feb 12, 2025
@jbruechert
Copy link
Collaborator

So to fix this the first step is inspecting the feed from our sources page to see if there's a useful string in there and if yes in which field.

Then we can improve the motis logic.

@dodoradio
Copy link
Author

so looking at https://api.transitous.org/gtfs/gb_bus-dft.gtfs.zip I can see in routes.txt, the short name is correct. it's just ignored by motis https://github.com/motis-project/nigiri/blob/master/src%2Floader%2Fgtfs%2Ftrip.cc#L191 , which assumes that rail lines are called letter+number.

@Altonss
Copy link
Collaborator

Altonss commented Feb 13, 2025

so looking at https://api.transitous.org/gtfs/gb_bus-dft.gtfs.zip I can see in routes.txt, the short name is correct

You meant this one https://api.transitous.org/gtfs/gb_great-britain.gtfs.zip.
For Avanti West Coast trains it seems to be "correct" and only contain the operator name in the short name.
For the London Overground the story is the same, each route just contains "London Overground" in the short route name, but this is missing the important information: the line name (like Suffragette).

@Altonss Altonss added the motis changes to the MOTIS routing engine are necessary label Feb 13, 2025
@felixguendling
Copy link
Contributor

I guess there're two options: changing the data or changing the trip name code in MOTIS. Both is fine for me. Just open a PR in nigiri 👍

@jbruechert
Copy link
Collaborator

jbruechert commented Feb 13, 2025

Yesterday I discussed how to improve this with @dodoradio, and we noticed that it would probably lead to better results if there can be different name handling strategies based on the feed. There are pretty much three categories:

  • Google Maps convention (whatever should be displayed is in the route_short_name)
  • semantic field use (route in route_short_name, individual trip number in trip_short_name, here the route_type should allow to pick a useful option)
  • chaos (here using a something like a regex to pick commonly understood formats like IC 123, RE 23, D 123)

The easiest option from the Transitous option would be a gtfsclean pass that converts all categories to the Google Maps convention, and then have MOTIS just follow what Google Maps does, but the same could also be done in MOTIS by adding a per-feed config option.

@felixguendling what would you prefer?

@dodoradio
Copy link
Author

dodoradio commented Feb 13, 2025

so looking at https://api.transitous.org/gtfs/gb_bus-dft.gtfs.zip I can see in routes.txt, the short name is correct

You meant this one https://api.transitous.org/gtfs/gb_great-britain.gtfs.zip. For Avanti West Coast trains it seems to be "correct" and only contain the operator name in the short name. For the London Overground the story is the same, each route just contains "London Overground" in the short route name, but this is missing the important information: the line name (like Suffragette).

@Altonss sorry yeah I did get the wrong gtfs link, thanks for correcting that.

So in general, the Overground lines are actually named correctly. I've checked and I can see that they're all there (Windrush, Lioness, Suffragette, Liberty, Mildmay and Weaver).
The routes that are shortnamed 'London Overground' seem to be diversions and replacement bus services. I traced three of them through the data, and they are all limited services which operate for one day, a week or every sunday for a week.
There's also some 'London Underground' shortnames in there which aren't given a line name. These services seem to also be diversions and also have a lifespan of a few days.
It's unfortunate that these diverted services have vague names, but I'm not sure there's a programmatic way to fix their names, and it's not worth doing manually because each one runs for a few days at most. At least the regular services are named correctly and I think we can trust their names.

Another small bit of weirdness is that 'Elizabeth Line' (a suburban-metro hybrid that operates like an underground line in the middle) is shortnamed 'Elizabeth line' while other london rail routes omit 'line' (eg. 'Bakerloo', 'Windrush', even though they're called 'Bakerloo line' and 'Windrush line' in all other tfl communications). That might actually need to be made consistent, but that also depends on how apps display the text etc.

TLDR: UK rail lines seem to already have useful names in the data, exceptions are diversions and rail-replacement buses

@felixguendling
Copy link
Contributor

felixguendling commented Feb 13, 2025

With MOTIS I always had this idea of "batteries included": just start MOTIS with a OSM dataset and a few GTFS timetables and you're good to go. No external tools needed. So in this sense, it would make sense to have a per-feed option which naming convention should be used. In an ideal world, GTFS-tidy would not be needed because MOTIS can handle everything. But doing things like Google Maps has never been a bad idea in the GTFS world. It would just be nice if the "regex" approach would still work on DELFI and similar datasets (that were obviously not optimized for use in Google Maps). Even if it's not perfect, I would guess that it's better than the Google Maps route_short_name approach (didn't try though).

@dodoradio
Copy link
Author

I understand the desire to have it 'just work', but I'm not sure it's a good idea to have it try to 'hotfix' the data in this way (eg. as it does with the IC/ICE). I feel like fixes should be done at the data cleanup stage, and from then on the data should be trusted, because those fixes can be much more granular and tailored to the individual data source. Otherwise, I feel MOTIS is forced to make assumptions about how the data is meant to look, which makes it more compatible with some data and less compatible with other data.

Though I think just giving the option to turn off filtering for a given feed is also a reasonable solution.

@Altonss
Copy link
Collaborator

Altonss commented Feb 13, 2025

I think the current logic implemented in MOTIS/Nigiri is somewhat wrong, and that is the main reason we are seeing incorrect short names. motis-project/nigiri#174 should help improving it (although not tested yet), and be closer to the behaviour of Google Maps.
This should probably fix most issues, therefore reducing the need for any data cleanup by a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request motis changes to the MOTIS routing engine are necessary
Development

No branches or pull requests

4 participants