Saturday 20th February 2010
Adventures of an Amateur Cartographer
Every lunch time I go out for a walk of four to five kilometres. Either I get the fresh air or I doze fitfully, head on keyboard, throughout the afternoon. Rather than listen to music for the hour or so of walking I've been in the habit of listening to technical podcasts. I keep an MP3 player dedicated to the backlog of podcasts I subscribe to including Futures in BioTech, BoagWorld, The Java Posse, MacBreak Weekly, Security Now, TWiG, TWiP and Windows Weekly (all of which I wholeheartedly recommend.)
While striding manfully across the streets of suburbia this week I've been listened to some back issues of FLOSS Weekly that I'd previously missed. This excellent podcast by Randal Schwartz covers all aspects of Free Libre Open Source Software, occasionally straying into open source hardware and, in the case of the podcast I was listening to, open source data.
This episode included an interview with Steve Coast of OpenStreetMap.org. Briefly, OpenStreetMap is an attempt to crowd-source the mapping of the whole world so that all the data is available under a Creative Commons licence. While services such as Google Maps are extremely useful, the underlying data is copyrighted and can't be used by third party mapping or navigation apps for iPhone or Android without paying significant licence fees. By collecting IP-free data OpenStreetMap makes free mapping data available to anyone who wants to use it.
Now Google Maps, and my Navman SatNav have a typo in the name of the street in which I live, and so on reaching home I checked the OpenStreetMap site to see if they had got it right. Initially I was disappointed to find that, although my street was on the map, it and a number of other local roads weren't named. And then I realised that this was my opportunity to use my lunchtime walks to make a small contribution to the common effort. The next lunchtime found me setting off with a screen print of OpenStreetMap.org, a pen and a GPS receiver.
The most important rule for updating the OpenStreetMap is that you mustn't copy the data from a commercial source, such as Google Maps or the Ordnance Survey. Instead you must get out there and check the street signs for yourself. Commercial maps contain deliberate errors that can be used to prove when their data has been copied. They can also be slow to update and so may not reflect the latest road topography - for example the Tele Atlas data used by Google doesn't show a local connecting road opened last year - but OpenStreetMap was updated with the new details five months ago.
Editing OpenStreetMap is pretty easy, there are a number of on-line and off-line graphical editors - I've been using the default Potlatch on-line editor which only takes a few minutes to get to grips with. The underlying data is stored as a network of nodes, each representing a junction, amenity or other landmark. A sequence of nodes connect up to form a 'way' which might represent a road, footpath and so on. Both nodes and ways can have a series of attributes stored as name/value pairs that record what they represent, their location, name and a host of other data. For example a local road is tagged with:
highway = residential name = Acacia Avenue
As you can see Yahoo! have kindly contributed satellite imagery to make the editing easier. Once you have completed your edits the maps displayed on the website, phones and SatNavs are not updated immediately. You have edited the underlying XML data, but a renderer needs to convert the data into graphical tiles that can be displayed at each of the supported map resolutions. The website supports two of renderers - Mapnik and Osmarender. Mapnik runs on a single machine and is supposed to generate new versions of the graphical tiles every few hours - though every few days has been closer to my experience. The OpenStreetMap database for the whole world is about 61 Gbytes and this has to be rendered into graphical tiles for 18 zoom levels, so this is a lot of processing.
Osmarender is more interesting in that it uses volunteer grid computing to distribute the rendering work across a group of machines on the Internet. It can re-render quicker and there is a neat little trick which allows map editors to mark particular tiles as high priority in the work queue so that they can check the rendering as quickly as possible.
Having updated all the street names hereabouts I got more ambitious and decided to add a new footpath recently built across the local park. To accurately plot the route I used a GPS tracking program on an Android phone. Currently I'm playing with two - My Tracks and GPS Logger. Both can record GPS data at regular intervals as an XML .gpx file on the SD card which can later be uploaded to OpenStreetMap. Once on-line the GPS data can be overlayed onto the map and a way traced over it. I found the whole process simple to carry out and accurate.
At some point during my editing sessions a bug in Potlatch meant that a way I had connected to, but not edited, was duplicated. Only one way was visible in the editor and the rendered map but the name of the street appeared twice. The second way was directly on top of the first. This gave me an excuse to take a look at the underlying XML data - you can select an area of a map and download the data as an XML document. The schema is easy to understand with the data being presented as a series of nodes and then a series of ways connecting those nodes. It was easy to see that the original way data was duplicated in a new way that the XML identified I had created (I deny everything!) This gave me the confidence to go back into the graphical editor and delete the way - the original way immediately reappearing in its place (much to my relief!)
I've really enjoyed my first week's tweaking as an amateur cartographer. It's added a little purpose and variety to my lunchtime walks, but the biggest kick of all has been seeing my updates appearing on the OpenStreetMap website and on the AndNav2 Android SatNav software.
Posted by frogplate at 22:56.