Using NZ Open GPS Maps from Linux

A GPS is one of those toys that I have wanted for a very long time. So last year I finally marshalled enough excuses in one place, lined them up and plunked down some money for a Garmin GPSmap 60CSx in the vague belief that there's enough Linux software out there which understands GPS, and the Garmin is a brand that seems to have mature Linux support. And besides, I'd been told it was a good model that would do what I wanted and then some.

Once I got it I naturally wanted to do stuff with it, and in particular I wanted to connect it up to my laptop which (of course) is running Linux and I found that it wasn't nearly as trivial as I had thought.

This prompted me to run around finding software to use with it, so here's my capsule review of my journey from "extremely naive" to "very naive". Perhaps I'll also learn something from the comments of people who are further down the track.

My first resort was "apt-cache search gps", of course, which immediately brings up such fine sounding programs as "gpsman", described as "A GPS manager" (I haven't managed to get it to do anything yet), "gpstrans" which since it specifically mentions Garmin GPS sounded like just the ticket (it appears to be quite old and superseded). There was some useful stuff as well.

gpsd Connects to your GPS and relays that in a format that all of the other software understands. This seems to have a fairly active development community. A bug I discovered was fixed quite quickly in a new release.
gpsdrive This software seems quite functional, though most of what it is trying to do is done by my GPS already. It can talk directly to many GPSs but I used gpsd for the actual communication, which provides broader support and multiplexes the GPS data so it isn't locked by a single applications.
gpsbabel This very powerful comannd-line tool will inter-convert many GPS data formats.

Getting Maps on the GPS

Since the Garmin GPSMap series will display maps, I wanted to be able to get some mapping data on there. There are two map sources I was interested in:

  • Map data from NZ Open GPS Maps which gives comprehensive coverage of New Zealand, and is free and community maintained, albeit with some annoying uncertainties about the licensing of the data, and it's being tied to Garmin GPSs.
  • Map data from OpenStreetMap.org which gives excellent coverage of many areas of the world, and is free for use under a creative commons license.

Using the NZ Open GPS Maps

The NZ Open GPS Maps are built specifically for the Garmin GPS, so getting them onto my GPS was relatively simple once I found out the exact command line was remarkably hard.

The program that I needed to find to be able to get the maps onto my GPS was sendmap20 which is a free (as in beer) download from the cGPSMapper Website.

I downloaded the maps from the NZ Open GPS Maps hosted on the cGPSMapper site. I needed the files identified as 'binary' files - the installer is a Windows program and no use on Linux. They all have filenames like 64000012.img.

The command-line I first used to install the maps onto the GPS was:

sendmap20 -t/dev/ttyUSB0 640000??.img

That works fine, but if you have even a moderately sized micro SD card in the GPS there are much faster ways. As I found more free maps I found much better ways to do it.

An alternative approach

In the GPS (well, in my one anyway) there is a micro-SD card which is FAT formatted and all of the installed maps are in one humungous combined image of all of the uploaded maps. This means that there is no way to straightforwardly add/remove maps without creating that image, and re-uploading the whole thing. The image file is called 'gmapsupp.img' and is in the 'garmin' subdirectory on the SD card.

This means that you can create the file (or even several different files, with different maps on them) and move them directly on there much quicker, either by taking the SD card out and using it in a USB2 reader (for really big files) or switching the GPS to operate in USB Storage mode (which is USB1, but OK for smaller files).

You can create the IMG file to copy in as gmapsupp.img with sendmap20 also, with a command-line like:

sendmap20 -lNZOpenGPSMaps.img 640000??.img

and then, if you mount the GPS as /media/GPS, you can copy that file on directly

cp NZOpenGPSMaps.img /media/GPS/garmin/gmapsupp.img

QLandKarte

Another program I found useful specifically for dealing with the Garmin GPS Map format is QLandKarte, which understands the native Garmin format and will display the maps in a graphical window.

You can also point and click to select maps, building up a specific set that you can then upload to the device from within QLandKarte itself. This seems to operate a lot faster than sendmap20, presumably because it's driving the USB directly, rather than through usb_serial. To get it to work I seem to have to (a) sudo rmmod garmin_gps and (b) sudo QLandKarte, however, which is definitely not ideal.

For the moment I will continue to use sendmap20 to create files which are sets of the maps I want, and will put them on the device in USB storage mode.

QLandKarte is still very useful, however, for looking at maps and deciding if they are worth bothering with. I used it in this way to select the Australian maps I took with me when I went to Linux.Conf.AU recently. There are more free Garmin GPS maps.

OpenStreetMap.org

Those Australian maps came from OpenStreetMap.org and ultimately I expect that it will become the best source of data for creating maps for my GPS. OpenStreetMap.org is an attempt to provide community-maintained maps for the whole world and which seems to have made significant progress in UK, Europe, America and Australia as well as many other parts of the world.

The data from OpenStreetMap.org does not have the same licensing restrictions as are present even in the NZ Open GPS Maps data (which is relatively free, but has problems similar to the old-style BSD license).

There are also some good mapping interfaces to the OpenStreetMap data although the searching currently still leaves something to be desired. Interfaces are also available for extracting subsets of the data, which is in a fairly straightforward XML format, or you can download the whole lot, but at nearly 3GB for the bzip2 compressed version you won't do it every day.

I gave a brief overview talk about OpenStreetMap.org while I was at Linux.Conf.AU and it seemed to go down quite well (I gave it several times, in fact). You don't need a GPS to contribute to the project, and of course the maps which are being created are usable for many purposes beyond their usefulness on GPS. Some people apparently even print them out, but that just seems weird!

[D] [Digg] [FB] [R] [SU] [Tweet]