Train routing

From OpenStreetMap Wiki
Jump to navigation Jump to search


This article or section may contain out-of-date information: It has been implemented as Tag:route=train
If you know about the current state of affairs, please help keep everyone informed by updating this information. (Discussion)


Currently we mark railway stations, and the sections of railway which join them. This is great for drawing maps, but not sufficient for routing.

For example, the physical layout of tracks might be something like this:

Rail route physical.png

but anyone who used the railway would be able to tell you that the connections look like this:

Rail route routeable.png

We need a way of tagging the actual journeys that you can travel by train, even if they share stretches of the same track. Perhaps the relation objects could be used?


Probably the best way is to count stations, and add them to the distance

One other approximation might be to assume that average speed is higher the further you travel on one train, e.g.:

Train routing cost.png

However, that still fails in lots of cases (short distance on intercity is way better than long distance on local train) so counting stations is definitely a good idea

Fidelity levels

Can we categorise the types of thing people want to do with train routing, so that any discussions can be tagged with the fidelity level they correspond to?

e.g. some problem may prevent us from doing 'Full' routing, but might not stop us doing 'Generic' routing if we wanted.

Fidelity level Description Data required
Basic Knows different rail operators on the same line, e.g. that you can get direct from Waterloo to Basingstoke, and from Waterloo to Hersham, but not from Hersham to Basingstoke Relations listing the connections between train stations
Generic Knows the number of trains per hour and average speed for a line. Makes reasonably accurate estimates of travel time along a variety of train routes, and can compare them with other forms of transport Train frequency and average speed on the 'route' relationships
Advanced As per 'generic' but with time-sensitive information, such as train frequency on different days of the week, or time of the last train, or likelihood of getting a seat on sunday evening, or number of bike spaces on a train Additional tags in the relation fields, but still stuff that could be entered by regular travellers without assistance from train companies
Full Contains actual timetable information, and can tell you to catch particular trains (similar to and similar) Regular import of timetable data from train operating companies
Full + dynamic As per 'full', but knows about train delays and closures, possibly even the current location of each train from mobile devices on board ???
Special Community updates, e.g. Morwen telling people that the circle line is closed on the day of the mapping party Communication methods between users


The suggestion of regularly updating timetabling information may run into licensing problems in the UK as National Rail Enquiries, TfL, South West Trains, and probably others have a clause on their website whereby you cannot take anything from it and store it on your own server. That said seems to have got away with it, by not actually storing the data, though I think they are in a dubious position.

Does it belong to the map?

Pavel: I'm not sure. I've done some routing before (see in czech republic, and the map info seems very auxiliary. You can route very well if you have time tables but not map. Map would be slightly useful to display proposed track, but it seems that timetables are separate problem and importing train positions from osm seems to be enough.

The map may be useful in those cases where a route involves walking from one station to a nearby other station. Some train/bus operating companies create such routes for their customers.

Mixing with other transportation types

This could be pretty useful if combined with other types of transportation. Extreme case: I need to go somewhere and I can take my car at a train station, take the bike that I have in the car with me, take the train and from the arrival station unfold my bike and finish the last kilometers by bike. To return back home, I do the reverse operation - possibly through another station. Think of any other combination: on foot, bike or car rental at the arrival station, ... . I would like to find out what the optimum way is (speed, ...) and what the best stations are. I agree that a time table is most likely the best association.


OSRM routing with