# Traveling by train

I think my favourite way to travel is by train so when the opportunity arises, if possible, I will try to take the train there, back or both. A good example of this is that I was fortunate enough to be invited to lecture at a summer school in Beijing in 2016. Whilst I flew out there the only logical choice was to take the train back (or at least as far as St. Petersburg).

One thing I’ve been thinking of doing for a while now is making map of all the rail journey’s I’ve been on. This has resulted in my Rail Journey Map which shows all the intercity rail journeys I have been on totalling ~24,000 km of travel.

Compiling this map was rather challenging and it took me some time to research how to do it. Below is the method I used. It might not be the best, but it worked for me.

### Creating the rail journey map

To create the map made use of a piece of open-source software called OpenRailRouting. The instructions are pretty clear on GitHub page about how to install and run it but a key piece of information is missing, at least for those not used to using OpenStreetMap (OSM) data.

To get the OSM data I had to download the 44GB planet PBF file and then use the Osmium tool to extract all the railway information. The command for this is:

osmium tags-filter -o planet-rail.osm.pbf planet.osm.pbf nw/railway

This results in a much more manageable ~350MB file. With this in hand you can run OpenRailRouting as described on the software’s webpage. This will setup a GraphHopper server locally which you can reach at localhost:8989. With this GUI you can select start and end points on a rail journey and the software will provide the route in between. You can also set intermediate points in case the software returns another route you didn’t take. Once you’ve settled on a route, you can export the GPX file by clicking the little ‘gpx’ button.

Finally, to plot all the routes together I used Mathematica as this made it very easy to change the map projection.

One useful thing to note is that the default configuration for OpenRailRouting only routes on standard gauge (1435mm) tracks. Many countries use this rail gauge but some, such as Ireland, Russia and Mongolia, use different gauges. You can modify the config file to add additional gauges easily.