14

I'd like to be able to see, for any station in the UK, a list of stations I can reach in a single train journey. This would be an early step in planning a trip, before looking at specific services or times.

The reason is that I often travel round the UK by a mixture of train and bike. Taking bikes on trains requires booking a bike space (usually), and things can go wrong if you miss your connection only to find there's no bike space free on the next train. So I prefer, where possible, to get one train at the start of my journey, then ride the rest of the way. Spaces can be very limited, and if one route is booked up, it's worth considering heading in a different direction.

An artificial example, where I can figure out a close-to-optimal answer easily: If I wanted to travel all the way from Bristol Parkway to Peterborough by train, I'd probably go via London. Getting the train to Paddington then riding would be about 150km. But getting the train to Derby (I thought Nottingham, but there aren't currently any direct trains) then riding would only be 100km (Birmingham New St, served by the same train as Nottingham, would be 150km again). Starting in Bristol I know the lines pretty well, so know which stations to check.

Coming home is a lot harder, e.g. Norwich to Bristol I think my best option is a train to Cambridge then ride.

So I'm looking for a way to list all the stations I can travel to without changing trains, from a particular station. If only lines/termini are listed, but I can get to a list of stations on each line within a click or two, that's also useful. Such a tool might be useful to anyone for whom changing is problematic, for example those relying on assistance (and perhaps taxis/lifts) may want to get a list of stations they can easily reach, to check accessibility and onward options.

7
  • BTW I've already trawled through all likely-looking links from Seat61's main UK rail page Mar 22 at 16:23
  • It is an extremely crude in format, but if you already have a good idea of the line you want, the eNRT might be of use Mar 22 at 16:30
  • @NicolasFormichella I see what you mean by "crude". But generating the list of lines (generally plural) is a significant step, and the station nearest where I'm starting may not even be listed in the eNRT PDF title. Or even stations nearest where I'm starting; I may be between 2 and want to try both. Mar 22 at 16:34
  • Look at the station list PDF in the archive @chrisH-UK Mar 22 at 16:36
  • 1
    @Tom I looked at that early on; unfortunately for my test cases it was common for operators and curves to join up in ways that trains don't (e.g. I'd have to take a mainline train then change to a local stopping service from the same operator) Mar 24 at 6:47

4 Answers 4

6

It's not a list as such, but this site does the trick:

https://direkt.bahn.guru/

Type in a station in the top right, click on the name in the list and give it a few seconds and then the map will show the stations you can get to, colour-coded to show the journey time. Click on a station to be able to click a link to a journey on the bahn.de website. It only shows one trip of course, you may find that at your time of departure there isn't a direct train.

Another useful service provided by Bahn is this page:

https://reiseauskunft.bahn.de/bin/bhftafel.exe

(choose English in the top right hand corner)

Type in the name of a station, choose a date and time and click on search and it'll show you all the departures at approximately that time, including the train's final destination.

3
  • That is very interesting. I tried my local station where I know all the direct services. One caveat is that, as far as I can see, it shows all stations with any direct train even if that only holds on one day of the week. Very useful nonetheless.
    – mdewey
    Mar 23 at 16:28
  • It's a nice map, and certainly useful. The train it picks when you click through to bahn.de seems completely random (like a week today for one that also runs tomorrow). It also comes up with something potentially useful and completely unexpected - if rather expensive - a direct service from Bristol Parkway to Cambridge once a weekday (but not the opposite way). Connecting the dots would make it even nicer of course Mar 23 at 16:45
  • With so many good answers it was hard to know which to accept, but this offers the most off the shelf. Mar 25 at 15:50
13

If you sign up for a TransportApi.com account you can do this using code. Note that the free account is limited to 30 requests/day so in practice you'll need a "Home Plan" for 5 pounds/months.

import requests
from datetime import datetime, timedelta

# Replace 'your_app_id' and 'your_app_key' with your TransportAPI credentials
app_id = 'api_id'
app_key = 'api_key'
departure_station = 'EUS'  # Example: Euston Station (EUS)

# Calculate start date as today
today = datetime.today()

# Function to fetch direct train destinations for a given date and hour
def fetch_direct_destinations(date, hour):
    formatted_date = date.strftime('%Y-%m-%d')
    url = f'https://transportapi.com/v3/uk/train/station/{departure_station}/{formatted_date}/{hour:02d}:00/timetable.json?app_id={app_id}&app_key={app_key}&train_status=passenger'

    response = requests.get(url)
    data = response.json()

    destinations = {}
    if not data['departures']:
        print("Failed to retrieve API response")
        return destinations
    for service in data['departures']['all']:
        destination = service['destination_name']
        service_id = data['departures']['all'][0]['service_timetable']['id']
        destinations[destination] = service_id
    return destinations

# Function to fetch the intermediate stations for a specific train service
def fetch_intermediate_stations(url):
    response = requests.get(url)
    data = response.json()

    intermediate_stations = []
    for calling_point in data['stops']:
        intermediate_stations.append(calling_point['station_name'])
    return intermediate_stations

# Fetch and print direct destinations for each day of the week and hour of the day
for i in range(1):  # Change the range value to fetch data for more days
    date = today + timedelta(days=i)
    print(f"Direct destinations from {departure_station} on {date.strftime('%A, %Y-%m-%d')} :")

    for hour in range(1):  # Change the range value to fetch data for more hours
        destinations = fetch_direct_destinations(date, hour)
        if destinations:
            print(f"{hour:02d}:00 - {hour:02d}:59:")
            for destination in sorted(destinations):
                print(f"  {destination}")
                # Extract and print intermediate stations
                intermediate_stations = fetch_intermediate_stations(destinations[destination])
                print("    Intermediate stations:")
                for station in intermediate_stations:
                    print(f"      {station}")

    print()

This will print the following:

Direct destinations from EUS on Thursday, 2023-03-23 :
00:00 - 00:59:
  Milton Keynes Central
    Intermediate stations:
      London Euston
      Harrow & Wealdstone
      Bushey
      Watford Junction
      Kings Langley
      Apsley
      Hemel Hempstead
      Berkhamsted
      Tring
      Cheddington
      Leighton Buzzard
      Bletchley
      Milton Keynes Central
      Wolverton
      Northampton

I ran out of free requests at this point but the code should print every hour of the day if you upgrade to a paid plan. Disclaimer: I'm not associated with TransportApi.com in any way.

3
  • Very interesting. I wonder if it's possible to get anything without specifying an hour, but even in one hour chunks 30 results could work for a few likely hours and a couple of stations. And you gave me python, which is what I'd use anyway for processing data Mar 22 at 19:04
  • 1
    @ChrisH-UK can't find it in their API but maybe a different API provider can do it.
    – JonathanReez
    Mar 22 at 19:35
  • 1
    @ChrisH-UK updated with full code to get every station along the route
    – JonathanReez
    Mar 23 at 21:54
4

Not a full list, at least not from the stations I checked as there were too many trains to fit in that window, the National Rail site has the option to see live departures, and if you do not give it a destination it will show all trains leaving in the near future.

I am used to train station information that show the departure states, with all trains leaving from that station for the whole week, with the current time table. (It may not show all stations for all trains but it will give the line and the main destinations on that line.)

I have not found those for the UK yet, but I think I have seen them in the past.
Running a search for one of the smaller stations I am familiar with: -all trains from Chippenham- gets me a page on the site of the company that usually runs trains from that station and that also gives a 'departures' list. As well as an option for an arrivals list, which will help you with the return journey.

A page like that may not be available for each station, as it seems to be run by the train company that runs the most trains there, but when available you can find most trains that would work.

4
  • 1
    +1, but I'm familiar with that (I use it every day in fact) and it's pretty limiting for busy stations. But it's a good way to check what lines serve a small station, and that's helpful. It's also only a click or two from the next step in the process - checking times on the day of interest Mar 22 at 17:35
  • Whatever method you use, the full list for a big station will be huge. (For many of my travels I use the German rail planner with 'no changes' selected, to see if there are direct trains, but it is often hard to find the route which does allow for this option, as it does not show anything if there are no direct trains.)
    – Willeke
    Mar 22 at 17:38
  • 1
    Indeed, but one huge list is better than several overlapping partial lists, which may or may not include everything. Mar 22 at 17:45
  • BTW the format of the old (mobile?) version of the site is probably more convenient. You can copy and paste it into a text editor and get one line per train. Even if just skim-reading it, you don't have to scroll. That's at ojp.nationalrail.co.uk/service/ldbboard/dep/CDF Mar 23 at 9:51
4

So I'm looking for a way to list all the stations I can travel to without changing trains, from a particular station. If only lines/termini are listed, but I can get to a list of stations on each line within a click or two, that's also useful.

The site https://brtimes.com (*) allows you to specify a station and a date within the next two weeks, and will then display all the scheduled services. The results page will show the services by time of departure and final destination; you can then click through into each service for a list of all intermediate stopping points.

It has 'hackable' URLs: for example, https://www.brtimes.com/!board?stn=BHM&date=20230323 is the departures today from Birmingham New Street (which has CRS code BHM).

It uses the industry timetable data so is as correct as it can be. You might also enjoy https://fastjp.com (*), which is a 'pure' journey planner (ie it doesn't worry about the mad arcana of tickets and their validity...)

* no affiliation, but it's free anyway

5
  • 1
    Copy-pasting the results from brtimes.com into a text file and running grep -Po "(?<=To: )[A-Z - ']*" trains.txt | sort | uniq on Linux gives me a list of termini (it returns text in all-caps preceded by "To: ", dropping duplicates). That's 44 unique values for BHM, and of course these tend to be either local or major places that I can roughly locate from memory. So that's really helpful Mar 23 at 10:52
  • 1
    @ChrisH-UK with a bit more code you could wget every train link and obtain a full list of unique train destinations. Can do it for you if you want, as that's a free option.
    – JonathanReez
    Mar 23 at 21:57
  • @JonathanReez that's a good point. It's a few years since I've written any web scraping code, so it didn't occur to me but I could do with the practice. I wonder if I could then look up their coordinates (via open street map) and plot them with their lines. Mar 24 at 6:42
  • @ChrisH-UK yeah and then use the Google Maps API to calculate the closest station to your destination by bike.
    – JonathanReez
    Mar 24 at 15:38
  • @JonathanReez close, but not Google Maps. Their bike routing is the worst of the tools I use. I keep meaning to set up my own install of Brouter, and I can now see a potential tool that will get me home from somewhere by train and bike (but I doubt I have the time to put all the pieces together) Mar 24 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .