1

Is there an API for rail company/ies, preferably for all UK locations?

Lat/long, train Id at a minimum but data such as train name, speed, from/to station, ETA, number of coaches/passengers, train type (freight/mail/passenger), etc will be useful too.

2 Answers 2

3

The UK is relatively good when it comes to open transport data. You might want to have a look at the APIs produced by Real Time Trains (although some of these are chargeable) or the Network Rail data feeds that cover both trains and infrastructure (e.g. temporary speed restrictions on particular pieces of track).

There is also lots of useful information on the openraildata.com wiki including a list of projects using open train data.

One thing that might be difficult is precise lat/lon data, since the rail network is set up to track trains between pairs of signals, so it may be that the available data only includes the location at what is referred to as 'signal berth' level. It should be possible to map trains to a point relating to each signal berth, but possibly not within each berth.

Good luck!

1

As mentioned by Matt, there is a lot of stuff available via open data. I actually had a use case for this myself, and I decided to build out and document a REST API to provide real time data. Might be of interest to anyone who finds this thread: https://rapidapi.com/jamesoneill997/api/uk-train-api

1
  • This looks very god. Thank you
    – Mawg
    Commented May 14 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.