Skip to content
saerdnaer edited this page Jan 25, 2012 · 8 revisions
  1. grab json_getter.py together with python-based Kothic from code.google.com/p/kothic/source/checkout

    hg clone https://kothic.googlecode.com/hg/ kothic
    cp -r kothic/src /var/www/vtile/
  2. install dependencies

    apt-get install twms python-psycopg2

    if twms not in the repository of your distribution (its currently only in debian testing) install it manually:

    hg clone https://twms.googlecode.com/hg/ twms
    cp -r twms/twms /var/www/vtile/
  3. import database with osm2pgsql, according to Mapnik’s manual: wiki.openstreetmap.org/wiki/Mapnik#osm2pgsql

  4. import coastline data to database:

    shp2pgsql processed_p.shp coastlines | sudo -u postgres psql gis >/dev/null
    echo 'ALTER TABLE coastlines OWNER TO gis;' | sudo -u postgres psql gis

    Alternatively, you can comment coastlines export out from the json_getter script (.extend() calls at the end)

  5. set up mod_rewrite redirection, to have cache. for example in /etc/apache2/sites-available/default

    <Directory /var/www/vtile/>
    Options +ExecCGI
    AddHandler cgi-script .py
    RewriteEngine on
    RewriteCond /var/www/%{REQUEST_URI} !-f
    RewriteRule ^vtile/([0-9]+)/([0-9]+)/([0-9]+)\.js vtile/json_getter.py?z=$1&x=$2&y=$3
    </Directory>

    don’t forget to enable the rewrite module

    a2enmod rewrite
    
  6. add following line in front of the json_getter.py script

    #!/usr/bin/python
    

    and allow execution

    chmod +x json_getter.py

maybe you have do modify the table names in line 29 if you used another prefix than planet_osm during import.

Clone this wiki locally