For the past few years, a gang of us go out for a sociable group cycle ride on a Friday evening. They’re called JoyRides and are organised by local bike co-op Peloton Liverpool. We have a real mix of ages, abilities, and bikes; a soundsystem supplying some tunes; and a growing collection of lights for over the winter.
The rides are also a great way to explore new parts of the city. We find quieter and different routes to get around, and slowly rewire our brains to plan routes like cyclists rather than motorists.
I often track the rides to see how far we’ve gone and, more interestingly, where we’ve been. I figured it would be nice to print them all out on a big map to hang on the wall.
Production Notes
The routes were gathered out on our rides with OSMTracker (and shared afterwards on this umap for interactive viewing)
Moving onto the print side of things, I found Printmaps. It’s some open-source software which uses Mapnik to render OpenStreetMap data, targetted at print resolutions.
Printmaps uses a yaml
file to configure things like the output page size, centre-point and scale of the map, etc. and to also overlay additional user data. I took one of their examples as a starting point and customised it to suit my purposes.
The Fahrplan+ map style available from that is a suitably muted style to let the bike routes stand out. However, there are some holes in the OpenStreetMap data coverage for buildings in and around Liverpool so I decided to hide those and emphasise the roads a bit more instead.
Hiding the buildings was trivial by adding HideLayers: buildings
to the yaml
file. Emphasizing the roads was a bit more involved, but not too tricky.
Overpass Turbo is a tool for querying and exporting subsets of the OpenStreetMap data. A quick search on the OpenStreetMap Wiki let me find the tags used for roads and I could then export the data from the relevant area of the world as a GPX
file.
I exported data for each of the road types, and the railways, although in the end I only added the railways, motorways, trunk and primary roads. I only wanted to make the roads a bit more visible, so left the other types to the version on the Fahrplan+ map.
While working on the map I spotted that the docks weren’t drawn in as bodies of water. A quick trip back to the OpenStreetMap Wiki and Overpass Turbo solved that.
While working on this I was iterating through the development loop for printmaps
, which is pretty simple:
- Once you’ve got a
map.yaml
file and theprintmaps
client installed, runprintmaps create
- Run
printmaps update
to upload your latestyaml
file - If you’ve added any new data files since last time, run
printmaps upload
to send them to the server - Kick off the build with
printmaps order
- Check to see how it’s going with
printmaps state
. If there’s something wrong with youryaml
file, or some data is missing, then you’ll get a message in the output from that - When it’s complete, you’ll have a set of coordinates in the
MapBuildBoxProjection
output fromprintmaps state
printmaps download
will download a zip containing the rendered image- Unzip it and check it, go back to step 2 until you’re happy with the results!
Once I started adding the bike route GPX
files they looked terrible. Zooming in I realised the problems were generally where we’d stopped for a while, so I looked at ways that I could get rid of extra points on the track and tidy them up.
In the end I used GPSBabel to simplify the tracks (bringing find
to bear on iterating over all the bike route tracks to process them as a batch):
cd original-tracks
find ./ -iname \*.gpx -maxdepth 0 -exec gpsbabel -i gpx -f {} -b ../simplify-gpx -o gpx -F ../{} \;
The simplify-gpx
has the options for GPSBabel, telling it to remove extra points there are within 16 metres of each other, and smooth it out with a rolling average of 5 points.
That tidied things up nicely and the map itself was then ready. All that was left was to add the title, explanatory text and the copyright info. That can all be done from within printmaps
and the remnants of my experiments with that are still commented out in the map.yaml
in the repository. However, I wasn’t hugely taken with the font, and the multi-step rendering pipeline isn’t best suited to lots of small tweaks. So I switched to using printmaps
to render the map and then pulled the resulting PNG
file into Inkscape where I could easily add the final components.