Creating maptiles with german style offline using mapnik and Ubuntu 12.04 LTS
Posted by skaiwalker on 28 December 2012 in English. Last updated on 30 December 2012.Please note
This post is obsolete and uses rather dirty methods. I added a quickstart guide to the README file in the mapnik-german repository, which should be used. However, this post might still be valuable for troubleshooting.
First, try to make Mapnik run using this guide:
http://wiki.openstreetmap.org/wiki/Mapnik#Installation
In case things don’t work, you might find clues there:
http://forum.openstreetmap.org/viewtopic.php?pid=253552
http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS
http://switch2osm.org/serving-tiles/manually-building-a-tile-server-12-04/
In any case, you want to use the latest available sofware, but you do not need to compile from source. There are PPAs.
Install necessary software
#### Mapnik Uninstall any python-mapnik or python-mapnik2 packages from your system (https://github.com/mapnik/mapnik/wiki).
sudo add-apt-repository ppa:mapnik/v2.1.0
sudo apt-get update
sudo apt-get install libmapnik mapnik-utils python-mapnik #[!sic]
osm2pgsql
sudo add-apt-repository ppa:kakrueger/openstreetmap
sudo apt-get update
sudo apt-get install osm2pgsql
postgis
sudo apt-get install postgis postgresql postgresql-9.1-postgis
Set-up data base
sudo -u postgres createdb -E UTF8 -O postgres osm
sudo -u postgres createlang plpgsql osm
sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
sudo -u postgres psql osm < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
Create user with YOUR name (somehow only works like this) postgis superuser? yes
sudo -u postgres createuser -P YOURUSERNAME
Now, get a map file. These are available at e.g.
http://download.geofabrik.de/openstreetmap/
wget http://download.geofabrik.de/openstreetmap/europe/germany/sachsen.osm.bz2
unp sachsen.osm.bz2
Finally, import your image into the database
osm2pgsql -m -d osm -S /usr/share/osm2pgsql/default.style -W sachsen.osm