How can I find all stations served by direct trains from a given UK mainline station?

3/23/2023 3:17:43 PM

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/23/2023 10:17:13 AM

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

3/23/2023 9:54:14 PM

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/22/2023 5:33:05 PM

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.

Credit:stackoverflow.com

About me

Hello,My name is Aparna Patel,I’m a Travel Blogger and Photographer who travel the world full-time with my hubby.I like to share my travel experience.

Search Posts