Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HowTo: GPSDrive with Mapnik and maps from
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message

Joined: 28 Oct 2002
Posts: 488
Location: Finland

PostPosted: Sun Jun 22, 2008 2:52 pm    Post subject: HowTo: GPSDrive with Mapnik and maps from Reply with quote

I will not cover setting up gpsd and will assume that you already have a working GPS source.

First some notes about dependency versions
I have installed this using glibc-2.7-r2 and gcc-4.2.4 - I do not know if it will work with glibc 2.8x and/or gcc 4.3.x.
I used boost-build-1.34.1 and boost-1.34.1-r2. Higher versions (1.35.0-r1) caused GPSDrive or Mapnik to fail to render maps (shows "No map available for current position").
Do not use LibTool 2.x, Mapnik will not build. I used libtool 1.5.26.

Setup PostgreSQL and Postgis
Install PostgreSQL by
#> emerge postgresql-server

and then postgis by
#> USE="proj geos" emerge postgis
I am not sure if it has to be built with proj and geos support, but Mapnik uses it so I added them.

#> emerge postgresql-server --config
to initialize the databases

#> /etc/init.d/postgresql-8.3 start
to start the server.

$> su
#> su - postgres

As the postgres user run the following to create the database:

NOTE: Replace username with the user that will be using mapnik.

$> createuser username
$> createdb -E UTF8 -O username gis
$> createlang plpgsql gis

Setup PostGIS
$> psql -d gis -f /usr/share/postgresql/contrib/lwpostgis.sql
$> echo "ALTER TABLE geometry_columns OWNER TO username; ALTER TABLE spatial_ref_sys OWNER TO username;" | psql -d gis

Finally add the user who will be using GPSDrive to postgres group in
/etc/group and login again.

Install Mapnik
Ebuilds for Mapnik can be found at

Add the ebuild to portage tree:
#> mkdir /usr/portage/sci-geosciences/mapnik
#> mv mapnik-0.5.1.ebuild /usr/portage/sci-geosciences/mapnik/
#> ebuild /usr/portage/sci-geosciences/mapnik/mapnik-0.5.1.ebuild manifest
#> USE="postgres proj debug doc gdal python bidi" emerge mapnik

Setting up necessary data for Mapnik
Here are more instructions:

I have condensed the most important.

World boundaries (51MB) and coastlines (~200MB):

$> wget
$> wget
$> tar -zxvf world_boundaries-spherical.tgz
$> unzip
$> mv coastlines/* world_boundaries/
$> rmdir coastlines
$> chmod -R 755 world_boundaries

#> mkdir /usr/local/share/mapnik
#> mv world_boundaries /usr/local/share/mapnik

Install osm2pgsql and the osm data
Needed is sci-libs/geos, the 3.0.0 version does not work; do
#> emerge =geos-2.2.3

Using svn (emerge subversion) get osm2pgsql from:

$> svn co
$> cd osm2pgsql
$> make

Now, add your downloaded map data (see ) by

$> ./osm2pgsql -d gis ../yourmapdata.osm.bz2

Later, if GPSDrive shows the position off by some 20 km, re-add the data with the -m flag.
(-m|--merc Store data in proper spherical mercator, not OSM merc).
For me, atleast, I first used the -m flag and my position was way off to the south, so I guess for now it should not be used.

OSM icons:
$> svn co
$> chmod -R 755 map-icons
#> mv map-icons /usr/share/icons

More information at
I am not sure if these Perl modules are needed but other howtos suggest them:

CMake is required for building, simply do
#> emerge cmake

libgda 3 is also needed, unmask in /usr/portage/profiles/package.mask, then
#> emerge =libgda-3.0.4

Then go on with GPSDrive:
$> svn co gpsdrive-svn
$> cd gpsdrive-svn/build
$> cmake -DCMAKE_BUILD_TYPE=Debug ..
$> make

#> make install

If all went well, GPSDrive should now be installed.
There are however some things that need to be fixed before it will work.

Create an empty waypoint file, avoids complaining.
$> touch ~/.gpsdrive/way.txt

#> mkdir -p /usr/lib/mapnik/0.5
#> ln -s /usr/lib/mapnik/fonts/ /usr/lib/mapnik/0.5/fonts
#> ln -s /usr/lib/mapnik/input/ /usr/lib/mapnik/0.5/input
#> mkdir /usr/local/share/icons
#> ln -s /usr/share/icons/map-icons /usr/local/share/icons/map-icons

#> mkdir /usr/share/fonts/truetype/ttf-dejavu
#> chmod -R 755 /usr/share/fonts/truetype
#> ln -n /usr/lib/mapnik/fonts/* /usr/share/fonts/truetype/ttf-dejavu/
Back to top
View user's profile Send private message
Tux's lil' helper
Tux's lil' helper

Joined: 29 May 2005
Posts: 119
Location: Germany

PostPosted: Sun Jul 06, 2008 7:09 pm    Post subject: Reply with quote

I have done everything according to this howto except I used the gpsdrive-2.10pre5 ebuild I posted here: It seems that something is still wrong because I cannot see any map data inside gpsdrive, and also when I try to generated tiles or an image with or from mapnik I only get white pictures with just the coastlines in there. But I see no streets etc. So I think my database is corrupt or not properly filled with data (although it took some hours when the postres database was filled). Can anyone help me here? How can I debug this?

Wow! It is working now! I have installed dev-db/postgresql-server-8.3.3 instead of dev-db/postgresql-8.0.15. I had to unmask dev-db/postgresql-server-8.3.3 to do this. Maybe the old postgres version was the problem... Thanks for this howto!
Back to top
View user's profile Send private message

Joined: 05 Dec 2004
Posts: 333
Location: Germany / Bavaria / Aschaffenburg

PostPosted: Wed Jul 09, 2008 8:02 am    Post subject: Reply with quote

This is a very nice Howto, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum