Sonntag, 15. Juli 2012

Ubuntu 10.04 has old PostGIS version

For the setup of my mapnik cloud server, I also need a new PostGIS database. I do not want to have my data on the cloud server, therefore I installed the database on a permanently hosted server (and pray that the connection between both servers is fast enough). This server runs on Ubuntu 10.04 and I followed these installation instructions for the DB setup:  http://switch2osm.org/serving-tiles/manually-building-a-tile-server/
But what a disappointment,  the Ubuntu package postgresql-8.4-postgis installs a verision 1.4 of Postgis on the 8.4 Postgres. 
But I have already migrated all map data from my PostGIS 2.0 installation and only hit the problem when I wanted to migrate the elevation data. But this doesn't work. The required database functions are not compatible.
Now I have to start from the beginning again.

Montag, 9. Juli 2012

Setting up Mapnik Cloud Server (Ubuntu 11.10 on Amazon EC2)

Rendering with mapnik is very CPU intensive, my PC needs about 500 hours to make a complete rendering of the alps from zoom level 1 to 15. This is frustrating.
It doesn't make sense to buy a powerful server either, because you don't want to render the map every day. This is a great use case for using the cloud.
A cloud server is a bare server with a standard OS installation only. And a server looses all data and configuration when you shut it down. (At least when you don't want to pay for a server which is not running. And this is the core idea of cloud computing)
Therefore it is necessary to have a setup script to fully enable the server for the intended function after the boot process. In case of mapnik, this script needs to install libraries prerequisites for mapnik, compile and install mapnik and put all configurations in place.
I don't want to place the PostGIS Database onto the cloud server. This server is supposed to be a stateless computation unit. The data must be located somewhere else. I will describe my complete setup in another post.

Here is the setup script. It is derived from the description on switch2osm. But I had to modify the libraries and added the mapnik configuration setup.

(
# INSTALL LIBRARIES
sudo apt-get update
sudo apt-get -y install git-core libltdl-dev libpng-dev libicu-dev libboost-python-dev python-cairo-dev python-nose libboost-dev libboost-filesystem-dev libboost-iostreams-dev libboost-regex-dev libboost-thread-dev libboost-program-options-dev libboost-python-dev libfreetype6-dev libcairo2-dev libcairomm-1.0-dev libgeotiff-dev libtiff4 libtiff4-dev libtiffxx0c2 libsigc++-dev libsigc++0c2 libsigx-2.0 libsigx-2.0-dev libgdal1-dev python-gdal imagemagick ttf-dejavu libxml2-dev subversion
# INSTALL MAPNIK
sudo mkdir /opt/mapnik
sudo chown ubuntu.users /opt/mapnik
cd /opt/mapnik
git clone git://github.com/mapnik/mapnik
cd mapnik
git branch 0.7 origin/0.7.x
git checkout 0.7
python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/truetype/
python scons/scons.py
sudo python scons/scons.py install
sudo /sbin/ldconfig
# GET MAPNIK STYLE
svn co -r 27279 http://svn.openstreetmap.org/applications/rendering/mapnik mapnikstyle
# GET SHADING IMAGES WHICH HAVE ALREADY BEEN RENDERED
mkdir mapnikstyle/shades
cd mapnikstyle/shades
wget http://{my_server}/hillshades.tar.gz
tar -xvzf hillshades.tar.gz
# GET CONFIGURATION FOR MAPNIK
cd ..
wget http://{my_server}/osm.xml
wget http://{my_server}/datasource-settings.xml.inc
mv datasource-settings.xml.inc inc
wget http://{my_server}/settings.xml.inc
mv settings.xml.inc inc
wget http://{my_server}/fontset-settings.xml.inc
mv fontset-settings.xml.inc inc
) >> /var/log/mapniksetup.log 2>&1

Freitag, 6. Juli 2012

Mapnik rendering CPU load

Ok, I know that my PC has a hard time rendering the tiles with python. But he shouldn't exaggerate. Such a sissy.


New style for tracks and paths

I have changed some more default mapnik rendering settings, which I don't like for mountain maps:

  1. Unclasified tracks are shown with an ugly brown dashed line which confuses the viewer of the map. It looks like it is a totally different kind of way. 
  2. Some OSM contributers define mountain trails as paths, others define it as footways. Therefore both get the same rendering style. I think in the mountains all trails are paths.
  3. In reality nobody can really assess the difference  between a T3 and T4 path, it's the same with tracks. Therefore all tracks and paths look the same, like on a ordinary topografic map.
  4. The black and white dashed lines for tracks looked to strong on zoom level 13 and 14. A dark grey without white looks more harmonic.
At the moment, you can see the difference near Unterammergau in Bavaria. On the left side of the street 'B23' is the new rendering style, on the right side is the old rendering style.