TrainRouter: 1,211 world passenger rail routes, traced onto the OSM rail graph

Hello,
I am new here. Flightmussy is not a company, it is an inside joke which I made. Hence, Flightmussy CEO is my pseudonym, not my position.

I am from Norway, and I have spent the summer building TrainRouter, a free interactive atlas of the world’s notable passenger train routes: 1,211 of them across 120 countries, high speed, classic intercity, night trains, scenic lines, heritage railways and funiculars, each with a short write up, a photo and the information behind it. There are no ads and no signup to this site. The route facts are open data, CC BY 4.0 with a Zenodo DOI, and the geometry traced from OSM stays where it belongs, © OpenStreetMap contributors under ODbL.

I am posting partly to say thanks, because it leans on OSM twice over. The basemap is OpenFreeMap vector tiles with MapLibre GL JS, but the part I would like feedback on is the geometry. The lines are not drawn freehand. Each route is snapped onto the real rail graph: a few waypoints along the intended corridor, the railway ways there pulled from Overpass, then routed along them, so the line follows actual track rather than a smooth curve between stations. Waypoints that turn out to sit off rail get dropped rather than dragging the path with them. For 155 European regional lines I also checked the result against live timetables, which caught some closed lines and a few bus replacements I had wrongly kept.

I should be straight about the state of it. It is early and there is a fair amount wrong with the map. The problem is harder than it looks from outside. There is no one authoritative source for what passenger services actually run worldwide: it is spread across national operators, wikis in a dozen languages and timetable feeds that do not agree, and rail tagging varies a lot by country, as you know better than I do. Faults are the normal condition of a project like this. The ones I know about: the selection is curated rather than complete, so coverage is lopsided, Europe being 58 percent of the atlas while Africa, South America and Oceania sit at three to four percent each. Some alignments still cut corners. Plenty of the facts come from Wikipedia and Wikidata and will be out of date. Someone on another forum concluded from it that the world barely has railways outside Europe and Japan, which was my fault for not saying clearly that this is a selection of what is more available to find, not a 100% complete network map.

So feedback is the point of posting, not a politeness at the end. What I most want: a line on the wrong alignment, a route that should start or terminate somewhere else, a service that no longer runs or is really a bus, and anything obviously notable I have missed in your country. Corrections get fixed as soon as possible and credited by name at trainrouter.com/corrections/, which already has a run of them from railway forums. I would much rather be corrected than be quietly wrong.

Maker here, happy to answer anything, including the awkward questions.

First of all, thank you for acknowledging that the geometry is derived from OSM data. We care a lot about being transparent about the upstream data sources, as do others in the geospatial community.

You’ve described a situation where the data about rail infrastructure doesn’t align well with published information about rail services. Is there anything that we can improve in OSM, as part of a broader ecosystem of open data projects like Wikidata, to make the kind of snapping and joining you’re doing less tedious and potentially error-prone? Are there any opportunities to make the data more useful so that one can achieve something similar more directly without needing an LLM to find inferences between these datasets? This is not to diminish the work you’ve done, but rather to draw insights from it beyond the product itself.

1 Like

Pretty interesting project you built there indeed, and curated each line for the appropriate info and pictures? Amazing stuff, congratulations.

I’m trying to understand though with what criteria you chose which lines you would mention on the map. I mean, in terms of usage, of the route it follows or a mix of various criteria?

I’m asking that, because I see in Greece that you show the line from Thessaloniki to Alexandroupoli, which has barely any train and thus it’s not used a lot, and you don’t show the line from Thessaloniki to Florina, which as part of Thessaloniki’s suburban railway has more frequent routes than Alexandroupoli’s line (similarly with not high usage, but for sure more than the other).
Also, you show the line Athens-Kalampaka as active, which isn’t correct because Kalampaka’s route starts from Palaiofarsalos (at village of Stavros) through the high-speed line (there’s no direct route from Athens), and doesn’t use the old railway line at all. And the green line you show below Lamia isn’t actively used by Hellenic Train (there seems to be bus replacement though according to their website).

2 Likes

Thank you, that is a generous way to ask it. I am going to be very honest that I have no engineering background, but I have been asking Claude Fable thousands of critical questions to Claude Fable for the deployments the last weeks. Besides I have been feeding it feedback from both me because I travel by train a lot and users from RailUK forum. To answer question, I am going to let Claude do it for me since it is a programming software.

Claude:

Four concrete things would have removed most of the pain, and none of them need new infrastructure.

First, more railway line items on Wikidata carrying P402, the OSM relation id. In my European sweep roughly 2,900 line items had it and 9,400 did not. Where it existed, tracing was nearly automatic. Where it was missing I had to guess a corridor and snap, which is exactly where the errors this forum finds come from.

Second, structured end of service data. The nastiest trap was lines that read as open but no longer carry passengers: a Danish line closed in 1961 whose end towns are still linked by a direct train on a different railway, a French line that has been a bus since 2018 while the feed still codes it as rail. I caught those only by reading article prose in past tense, in whatever language the article existed. Consistent closure statements on Wikidata (P576, P3999) and lifecycle tagging in OSM would turn that into a lookup.

Third, station identity. Joining OSM stations to timetable feeds by name fails constantly: Italian feeds shout in capitals, Finnish stations appear under Swedish names. uic_ref tagged consistently would make the join deterministic.

Fourth, service level route relations. Where a route=train relation existed for the actual passenger service, everything was easy. Most of the world maps only the infrastructure, and the gap between track and service is the whole difficulty of this project.

To your direct question: the geometry never needed an LLM. Overpass, a rail graph, shortest path held to a corridor, GTFS shapes as the check. The language model earned its keep only where structured data ends and prose begins, deciding whether a line still carries passengers. Close that gap and you close the one you are asking about.

I do not pick the all routes myself although I feed Claude my route suggestions so that it knows what types of routes it should pick. I have personally asked Claude to add and correct many routes which has helped it be better at verifying the routes. I think it is impossible to do it 100%, unless there is a community that constantly correct it. Therefore, there will be mistakes until someone like you who actually lives correct them.

I live in Norway so I have been extremely strict with Claude there. I also have travelled a lot by train in Austria and Czech Republic so I have been giving suggestions there to pick routes.

The routes suggestions also comes from the RailUK forum, which covers the countries where I have no personal experiences with traveling on rail. Already OSM has giving suggestions for route changes which further makes Trainrouter more accurate.

Looking at Ireland, some geometry looks a little bit off, here the line is shown crossing the sea (admittedly bits of it do fall into the sea from time to time!), and also the Dublin to Rosslare and DART routes follow exactly the same line, whereas here they look like parallel but separate lines.

The Dublin to Cork route starts at Heuston (like Dublin to Tralee), not Connolly as shown here. Only a few commuter trains make that loop around the north of Dublin.

You seem to have fairly full coverage in Ireland, only a few branch routes like the one to Ballina and Waterford to Limerick Junction are missing.

Turning to Spain, all 3 routes here should terminate at the same station, Malaga Maria Zambrano - I’m not sure if this is a geometry issue or intentional to separate the routes.

Generally for Spain I had the same thoughts as @jimkats on Greece, the routes shown feel rather arbitrary. E.g. Ciudad Real to Manzanares is a minor regional route, while InterCity routes such as Sevilla to Huelva (admittedly with relatively infrequent service) are not shown. Also, while people of Galicia might complain that they have poor rail connections, they are not quite as cut off as this suggests.

A couple of long narrow gauge (Ancho Métrico “AM”) are labelled as Cercanías which refers to shorter commuter trains. Admittedly Renfe’s overall presentation of their AM services can be hard to follow, but I’m almost sure they don’t use the Cercanías label for those particular routes.

“Mr Henderson’s Railway” feels a little odd as it is really a historic route rather than a current one. It’s not possible to do this with a single train these days - something that doesn’t really come across in the description.

I also wondered about labelling routes with brand names like “AVE” which is specific to Renfe. Malaga to Madrid is served by Iryo and Ouigo as well a Renfe, and even Renfe offers both AVE and Avlo. I’m not sure of the best approach to this - is this one route, or 3, or 4?

Finally this may be a Wikipedia issue, the photo illustrating Mr Henderson’s Railway is of the Granada to Almeria line (east of Granada), not Granada to Algeciras.

I hope that is helpful, this seems like an epically difficult undertaking! Especially the core issue of defining “what is a route” to start with, I honestly don’t know how I would define that myself.

1 Like

Thank you for pointing it out. I have been struggling with Spain especially. I have asked Claude many times to readjust for Spain and it struggled again and again to find not only correct trajectory, but to even try to follow the OSM lines.

For Ireland I personally do not know much about so I am thankful for you over there.

I used Claude Code and it could actually verify that your suggestions are correct:)

1 Like

Thank you all for the questions and feedback! They were honestly very difficult to answer but I hope that I managed to answer the questions in a good way, through partly my experience doing this project and Claude’s code input.

The feedback should be corrected by now and it is under here TrainRouter Corrections Log — Errors Found, Fixed and Credited

Please let me know if there are anything else;)

I appreciate the additions for Ireland. One other small thing: Dublin to Waterford trains call at Kilkenny, which involves following a spur into Kilkenny and reversing over the same spur. Your map misses out that part.

As you’ve gone so far in Ireland you might want to add Cork to Tralee (you already have the lines it runs on, but it is a route with direct trains in its own right). And the Limerick to Ballybrophy branch line. I think you’d then cover pretty much the whole Irish Rail network (maybe not NIR).

1 Like

Have you tried matching the other way around? I don’t know the data situation for rail lines, but it’s common to link OSM to wikidata by tagging objects with the wikidata id in OSM, not the other way around by adding the OSM id in wikidata.

3 Likes

Thanks for the details! The photos are a big help. It took time to verify it since it is very specific, but it should be added now.

I want to check the same scenarios for the other destinations at another time. I would love to have correct station routing for each route, although that must be crazy work.

I hope that Ireland has enough details. It must be awesome to see the scenery while taking the train.

I personally can only verify that Norway is fully added. I also know that Czech Republic has missing lines, since they have a dense railway network which has many branches. I can imagine that many countries have missing routes at the moment.

Thanks a lot for the suggestion! I asked Claude Code to verify this suggestion and it seems that it might be a way to get even better data to Trainrouter. According to it Trainrouter can better data because of your suggestion. I want to see if that it is actually the case tomorrow, because I would love to have more accurate data for the map.

Please don’t post raw AI output, this is a space for communication between humans and I’m not particularly keen on talking with a bot.

9 Likes

Thank you the addition.
Even though it does ran on the same line as Salonika-Monastir, and the tracks do connect to Bitola even nowadays (Florina’s suburban line leaves that main line at Mesonisi, just before Florina city), there are no services yet because Greece’s side is supposed to modernize the line that runs till the border, but it’s unclear when that will be done.

Other Greece’s railway lines that are in use and don’t exist yet on your map, are towards Patras from Athens. Specifically:

  1. extension of the suburban line from Kiato until Aigio (this section is currently active, further extension works towards Patras are already half-completed). There’s a bus replacement from Patras to Kiato (not to Aigio, because the Aigio-Kiato section has less frequent trains).
  2. two suburban lines within Patras (running on the tracks of the old line Patras-Kyparissia, and the currently active section will be modernized in the future as part of the extension from Athens). The current suburban lines of Patras run from Rio to Agios Andreas and from Agios Andreas to Kato Achaia.
  3. the other two suburban lines of Athens, one from Piraeus to Athens Airport, and one from Athens to Chalkida (following the same line as Athens-Thessaloniki, and leaving it at Oinoi).
1 Like

For example I saw you have the night train from Rome to Munich and from Rome to Vienna as 2 separate features, but it is the same train starting in Rome, and gets split at some point.
The Vienna-Rome connection says on your map “in service since 2021”, but the same service was already operating since 1993 according to wikipedia: Allegro Tosca - Wikipedia
and I would not be surprised if there were predecessors reaching back to the nineteenth century.

1 Like

I see, I am sorry. I will not post Ai anymore here. Thanks for letting me know.

The reason why I thought it could be a good idea is because I let Claude Code do the technical stuff for me. All answers where I have pasted Ai is from after 30 min analysis on Claude Code, because it understands Trainrouter a lot better than me when it comes to engineering.

I will see how I can answer it on my own from now on. I have also edited out Ai from all of the replies besides this one to Minh_Nguyen.

1 Like

In Portugal, the eastern half of the Algarve line is missing. Since last month it is posible to travel the full length of the line without changing at Faro, so I think this could be considered a single route.

1 Like

I will investigate it further and verify later. I think the reason why it is mentioned as recently is because of ÖBB Nighjet is a pretty new service.

Thanks for letting me know! I hope that it is possible to add it to the map. I will check and verify later today:)

Unfortunately, this gives lots of bad and useless results like your TGV Paris-Brest : it starts from the wrong train station in Paris (Gare-du-Nord), does a first U-turn near Saint-Ouen, does a second U-turn near the Eiffel Tower and uses the legacy line all the way to Brest.

2 Likes