Two options came up, GpsDrive and Navit - both of which recommend map data from Open StreetMap. Of these only Navit is available in the Debian/Raspian repository, so I tried that first.
$ sudo apt-get install gpsd gpsd-clients navit
Since Navit is a graphical tool, you'll either need to run with a screen attached, or ssh in with X forwarding and display Navit on your computer. I did the later, there is hardly any GPS signal where our TV is, and I don't yet have any other suitable screen.
Assuming gpsd is working and you're getting a good location from the GPS, when running Navit for the first time you get a black screen with a little green circle for your location - since it doesn't come with any useful maps pre-loaded.
Installing a Map
I followed the wiki links to the Navit Planet Extractor website, drilled down through the menu of pre-defined areas, picked Scotland, and waited for the map file to download. I then copied this to my RPi, and put it in a maps folder with a more meaningful name:
$ mkdir maps
$ mv osm_bbox_-8.1,54.5,-0.1,61.4.bin maps/osm_Scotland.bin
Referring to their Navit configuration instructions, I need to start by creating a configuration file based on the template provided, and then added the new map to it:
$ cp /etc/navit/navit.xml ~/.navit/navit.xml
$ sudo apt-get install emacs
$ emacs ~/.navit/navit.xml
Scanning the example configuration you come to a OpenStreetMap example entry:
<!-- Mapset template for openstreetmaps -->
<map type="binfile" enabled="yes" data="/media/mmc2/MapsNavit/osm_europe.bin"/>
So I copied that, switched it to enabled="yes", and pointed it at my new Scotland map file:
<!-- Mapset template for openstreetmaps -->
<map type="binfile" enabled="yes" data="/home/pi/maps/osm_Scotland.bin"/>
I also disabled the sample map. Next time I ran Navit, I saw this at the terminal, and a map on screen:
navit:main_real:Using config file '/home/pi/.navit/navit.xml'
|Navit on Raspberry Pi showing Dundee using OpenStreetMap|
Since this Scotland map was only 126MB, I decided to download the entire British Isles. Using the mouse on the Navit Planet Extractor website I picked bottom left (49.5, -11.2) and top right (61.1, 3.0), giving a 441MB file instead.
There is in fact a Navit world map available, at the time of writing 9.2GB in size (which would fit fine on a 16GB SDHC card if I really wanted to use it).
Building Navit from SVN
At this point I wondered if I could build Navit on the Raspberry Pi (see Navit on Linux instructions) from their SVN repository (recommended on their website), as the Raspbian package is already quite dated. Getting the build dependencies the easy way failed:
$ sudo apt-get build-dep navit
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: You must put some 'source' URIs in your sources.list
Seems a little configuration is needed perhaps? Having played with apt-rdepends, this seems to work instead - perhaps overkill:
$ sudo apt-get install subversion espeak cmake freeglut3-dev imagemagick libdbus-1-dev libdbus-glib-1-dev libdevil-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgarmin-dev libglc-dev libgps-dev libgtk2.0-dev libimlib2-dev libpq-dev libqt4-dev libqtwebkit-dev librsvg2-bin libsdl-image1.2-dev libspeechd-dev libxml2-dev ttf-liberation
And now the build - the output from cmake looked good, make itself took half an hour on the RPi:
pi@raspberrypi ~ $ mkdir repositories
pi@raspberrypi ~ $ cd repositories
pi@raspberrypi ~/repositories $ sudo apt-get install cmake subversion build-essentials
pi@raspberrypi ~/repositories $ svn co https://navit.svn.sourceforge.net/svnroot/navit/trunk/navit/ navit
pi@raspberrypi ~/repositories $ cd navit
pi@raspberrypi ~/repositories/navit $ mkdir build
pi@raspberrypi ~/repositories/navit $ cd build
pi@raspberrypi ~/repositories/navit/build $ cmake ..
pi@raspberrypi ~/repositories/navit/build $ time make
The docs tell you to run this in place. We also have to update this configuration file as discussed above to use the new map:
pi@raspberrypi ~/repositories/navit/build $ cd navit/
pi@raspberrypi ~/repositories/navit/build/navit $ emacs navit.xml
pi@raspberrypi ~/repositories/navit/build/navit $ ./navit
Running from source directory
vehicle_gpsd:vehicle_gpsd_try_open:Trying to connect to localhost:default
vehicle_gpsd:vehicle_gpsd_try_open:Connected to gpsd fd=5 evwatch=0x1c6f30
navit:main_real:Using config file '/home/pi/repositories/navit/build/navit/navit.xml'
See my next post on using a TomTom Bluetooth Remote with a Raspberry Pi, including remapping the buttons.