GpsDrive

Background
GpsDrive is a GPS navigation application which runs on Linux. This article covers getting latest available version of GpsDrive (2.10_pre7) to (usefully) run on Gentoo linux, using OpenStreetMap as data source, and Mapnik as a map renderer. PostgreSQL is used as a storage backend in this configuration.

How-to
Make sure following use flags are enabled for the packages (add following to your package.use file):

Next, unmask needed packages. GpsDrive changes dramatically between even pre releases, so it is crucial to get latest version. Add the following to your package.keywords file:

As a following step, emerge GpsDrive and osm2pgsql script. Everything else will be pulled in automatically as a dependency.

If you did not have it already, PostgreSQL will be merged at that stage. As requested by ebuild, you will need to configure your PostgreSQL installation. Adjust to your PostgreSQL version.

Change password for postgres user, so that you can su to it later:

Next, su to postgres user and create account and database for your data. Substitute [username] with username of the user who will be running GpsDrive, e.g. your normal user name.

You can start PostgreSQL at that point.

Download data you need from OpenStreetMap. You can go with whole planet, but beware that it will take many hours on a powerful machine to import it. More balanced solution is to go for an extract, such as one provided at Import for Sweden took only couple of minutes for me. The next command is also to be run by postgres user.

Next, create some work-aroundish symlinks:

Start gpsd.

Check that gpsd actually works.

You should see a stream of NMEA messages on the screen.

GpsDrive rewrites osm.xml file in ~/.gpsdrive on every restart. This file is configuration file for mapnik, and, among all, contains path to PostgreSQL socket. So this needs to be fixed:

This needs to be run before every restart, so it is a good idea to have some sort of startup script which will run that first, before starting gpsdrive itself.

As your normal user start gpsdrive in console, so that you can see any complaints.

Conclusion
GpsDrive should now be displaying pretty map rendered by mapnik.