Station List between stations

131 views
Skip to first unread message

neil scales

unread,
Mar 26, 2016, 3:37:30 AM3/26/16
to A gathering place for the Open Rail Data community
I'm developing an app that needs to know all the possible stations between a start and destination station.

I am currently using both Darwin and TransportApi to get live and planned train information but this will only provide a list of stations stopped at by a particular train.

Is there an API somewhere to give me this list?

Neil

Rail Ale Fan

unread,
Mar 31, 2016, 11:43:14 AM3/31/16
to A gathering place for the Open Rail Data community
Hi Neil,

Since a start and destination station are involved, if you only need to know all possible  stations serviced by direct trains between the two stations this can be derived from the timetable dataset;

http://nrodwiki.rockshore.net/index.php/AtocTimetableFeed

For example, for services from Stafford to Manchester Piccadilly

http://www.railalefan.co.uk/rail/stations.php?dep=STA&arr=MAN

I already have the timetable feed parsed into a `services` table which includes a `route` column containing a slash separated list of all calling points, for example;

services.origin = "BHM"
services.destination = "LIV"
services.route = "BHM/CSY/WVH/PKG/STA/CRE/RUN/ALE/LIV"

So in stations.php, the route column is queried using a suitable LIKE clause to return all distinct calling point sequences between origin and destination from which the distinct station list can be derived and just needs to be de-duplicated.

As my database also has lat/lon data for all stations ( from https://data.gov.uk/dataset/naptan ) the list is then sorted by distance from origin (destination always last though!).

Routing of course is not taken into account, continuing the above example, there are no scheduled services between Stafford and Manchester Picadilly that call at both Macclesfield  and Wilmslow.

Also consider, if it is relevant to your application, last-train stoppers / positioning services that have calling patterns that are not consistent with the hourly/regular daytime schedule.

Hope this helps!
Reply all
Reply to author
Forward
0 new messages