Skip to content

SamLolo/UK-Rail-Connectivity

Repository files navigation

Investigating the Importance of Connectivity Versus Location in UK Railway Stations

This code was created to investigate the relationship between infrastructure-level connectivity and the population catchment area of stations, and how these properties affect the usage of a station. The results of this research will help understand how passengers interact with the railway network, hopefully leading to better demand forcasting when planning new stations.

Datasets

Due to size contraints, datasets are not included with the code. They can be found at this publically-accessible Google Drive:

https://drive.google.com/drive/folders/1YFYg_ajejytT_EkNVwIL3L9bJ4j4wool?usp=sharing.

More information on each of the datasets used, including when they were obtained, can be found below:

Timetables: Obtained from the Network Rail Integrated Planning System, via their Open Data Feeds Portal 1. Data was downloaded as a single JSON file from the SCHEDULE feed on the 10th February 2026.

Station Information: Station information, such as geolocation, was obtained from Office of Rail and Road (ORR) on 25th February 2026 as an Open-Document Format (ODS) file 2. Reference data required to link the stations to their timing location codes (TIPLOCS) was obtained from Network Rail's CORPUS feed on their Open Data Feeds Portal 1. This file was downloaded as a single JSON file on the 23rd February 2026.

Passenger Usage: Journey data is published as an Origin-Destination Matrix by the Office of Rail and Road (ORR) every year. This research uses the 24/25 data, downloaded from the Rail Data Marketplace on 16th February 2026 as a csv file 3.

Population Data: Population data is obtained using the output areas from the 2021 census 4, and their corresponding population estimates 5. These are both published by the Office for National Statistics, and were obtained on 16th February 2026. The output area boundaries should be downloaded as a GeoPackage (GPKG) file.

Mapping Boundaries: Additonal boundaries of the UK, and the countires within it, were used for creating the map visualisations. These were obtained as shapefiles from Natural Earth 6. The boundaries used are the 10m, Admin o - Details, Map units, version 5.1.1, downloaded on the 4th March 2026.

Running the Code

The analysis was carried out using Python 3.13.12 inside an Anaconda environment, using Conda 26.1.1. All packages and versions used are saved within the enclosed environment.yml file.

To create & activate the environment:

conda env create -f environment.yml
conda activate networks-cw

Once inside the environment, build the networks by running the following scripts in order:

cd code
python stations.py
python schedule.py
python networks.py

Each of the analysis files (degree.py, eigenvalue.py, louvain.py, scale_free.py) can be run inside the environment as above. Results are printed to the console!

Footnotes

  1. https://www.networkrail.co.uk/who-we-are/transparency-and-ethics/transparency/open-data-feeds/ 2

  2. https://dataportal.orr.gov.uk/statistics/infrastructure-and-environment/rail-infrastructure-and-assets/table-6329-station-attributes-for-all-mainline-stations/

  3. https://raildata.org.uk/dataProduct/P-239916c0-7dfa-479a-94c8-0b0958e26185/overview

  4. https://geoportal.statistics.gov.uk/datasets/ons::output-areas-december-2021-boundaries-ew-bgc-v2/about

  5. https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/datasets/censusoutputareapopulationestimatessupportinginformation

  6. https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-details/

About

An investigation into the importance of route connectivity for UK mainline railway stations compared to surrounding populations for the sucess of a railway station.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages