Distance between stations / Journey length

1,107 views
Skip to first unread message

Eugene Bryce

unread,
Nov 24, 2023, 8:08:31 AM11/24/23
to A gathering place for the Open Rail Data community
Hello, I need to get information for users on journey length in km/Miles travelled by a train journey between two stations, with options for selecting the train route the user may of chosen.
What 'route' should I take and what database do I need access to from NR to be able to enter the start and end stations, selectable from the database, and then return the possible routes with the distance for the user via an API or similar?
thanks.

Michael Flynn

unread,
Nov 24, 2023, 9:33:21 AM11/24/23
to A gathering place for the Open Rail Data community

Hi Eugene,

A PDF of mileages between stations can be downloaded from Network Rail's website;


The direct link is;

I have PHP code which parses this data into a MySQL database but it is quite a few years old and was based on the same data but that included in the Network Rail timetables as opposed to these PDF's  If you want I could upload this code though it might need a bit of tinkering.  

There might be a dataset already available but I don't know of one and as the data changes over time with new stations, etc., you are probably best maintaining your own database.

Mike 

Gaelan Steele

unread,
Nov 24, 2023, 9:38:16 AM11/24/23
to 'Adam Stead' via A gathering place for the Open Rail Data community
Sources I’m aware of include the Routeing Guide (download instructions at https://wiki.openraildata.com/index.php?title=DTD) and BPLAN (available from https://wiki.openraildata.com/index.php?title=BPLAN_Geography_Data).

I haven’t tried to use the data from either source, so I can’t comment on the quality of either.

To do this “properly” you may also need timetable data (e.g. from the National Rail or Network Rail CIF files), as routes that look possible on a map may not have services running or may require doubling back; but if the user is selecting a route anyway you may be able to get away with that.

Best wishes,
Gaelan

--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openraildata-talk/efb4a615-07d9-4e16-8e37-30a170b324afn%40googlegroups.com.

Evelyn Snow

unread,
Nov 24, 2023, 10:24:31 AM11/24/23
to openrail...@googlegroups.com
Hi Eugene,

You'll have to be more specific about your use case here. There's a few approaches that can be taken, and which
approach is the right approach depends on why you're doing this, the level of accuracy you want, and how important
it is that the journeys for which distance is calculated align with something a reasonable journey planner would
recommend.

Evelyn

Michael Tsang

unread,
Nov 24, 2023, 12:03:54 PM11/24/23
to openrail...@googlegroups.com
Hello Eugene,

The official distance data for use in journey planners are available
from National Rail in the electronic National Routeing Guide data
(eNRT). I have a prototype implementation (using hardcoded extracted
data) at https://miklcct.com/station_link using the source code
located at https://gist.github.com/miklcct/f6e465c8062121c50ffa727415262108
, and in the future I may integrate these distance data into my
timetable website at https://gbtt.uk/ .

Michael
> --
> You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/openraildata-talk/e3b4fdc6-1e7c-452a-a4b1-96bab4d05600n%40googlegroups.com.



--
Sent from Gmail

Eugene Bryce

unread,
Nov 27, 2023, 11:47:07 AM11/27/23
to A gathering place for the Open Rail Data community
Dear all, thank you for your thoughts and comments on my issue.
Seems like I need to combine a couple of datasets to get the route and then the miles between the stations.
Let me digest the suggestions and speak to someone better with databases.
I have found the lat / long location of all stations which may help when tied with a route.

Owen O'Neill

unread,
Nov 28, 2023, 9:35:26 AM11/28/23
to A gathering place for the Open Rail Data community
Hi Eugene,
If your chosen route to work it out ends up being combining schedule data with BPLAN or similar, and depending on the level of accuracy you need - could use this dataset to work out the distance between each tiploc along a schedule.
available in national grid coordinates as well as lat/long so working out distance between tiplocs is trivial maths.
https://github.com/oweno-tfwm/YA_Tiploc_List

cheers
Owen
Reply all
Reply to author
Forward
0 new messages