Joined: 28 Oct 2002
|Posted: Sun Jun 22, 2008 2:52 pm Post subject: HowTo: GPSDrive with Mapnik and maps from OpenStreetMap.org
|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 - 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
$> 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.
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: http://wiki.openstreetmap.org/index.php/Mapnik
I have condensed the most important.
World boundaries (51MB) and coastlines (~200MB):
$> wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz
$> wget http://hypercube.telascience.org/~kleptog/processed_p.zip
$> tar -zxvf world_boundaries-spherical.tgz
$> unzip processed_p.zip
$> 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 http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/
$> cd osm2pgsql
Now, add your downloaded map data (see http://wiki.openstreetmap.org/index.php/Planet.osm ) 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.
$> svn co http://svn.openstreetmap.org/applications/share/map-icons
$> chmod -R 755 map-icons
#> mv map-icons /usr/share/icons
More information at http://www.gpsdrive.de
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 http://svn.gpsdrive.cc/gpsdrive/trunk gpsdrive-svn
$> cd gpsdrive-svn/build
$> cmake -DCMAKE_BUILD_TYPE=Debug ..
#> 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/
Tux's lil' helper
Joined: 29 May 2005
|Posted: Sun Jul 06, 2008 7:09 pm Post subject:
|I have done everything according to this howto except I used the gpsdrive-2.10pre5 ebuild I posted here: https://bugs.gentoo.org/show_bug.cgi?id=97208. 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 generate_tiles.py or generate_image.py 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!
Joined: 05 Dec 2004
Location: Germany / Bavaria / Aschaffenburg
|Posted: Wed Jul 09, 2008 8:02 am Post subject:
|This is a very nice Howto, thanks!
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