Extension:SlippyMap/Mapnik

Some notes on setting up a mapnik rendering:

Set up PostGIS
See: http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

postgres@aoeu:~$ createuser gis Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) n postgres@aoeu:~$ createdb -E UTF8 -O gis gis postgres@aoeu:~$ createlang plpgsql gis

Run this:

psql -d gis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql

That alters the gis schema like so:

gis=> \d List of relations Schema |      Name       | Type  |  Owner +--+---+-- public | geometry_columns | table | postgres public | spatial_ref_sys | table | postgres (2 rows)

chown them:

postgres@aoeu:~$ echo "ALTER TABLE geometry_columns OWNER TO gis; ALTER TABLE spatial_ref_sys OWNER TO gis;" | psql -d gis ALTER TABLE ALTER TABLE

Import the planet
You have to cd to the osm2pgsql directory so it can read its default.style file. avar@aoeu:~/src/mapnik$ cd ~/src/osm/applications/utils/export/osm2pgsql/ avar@aoeu:~/src/osm/applications/utils/export/osm2pgsql$ ./osm2pgsql -m -U gis -d gis ~/src/josm/Iceland.osm osm2pgsql SVN version 0.66-16445

Using projection SRS 900913 (Spherical Mercator) Setting up table: planet_osm_point Setting up table: planet_osm_line Setting up table: planet_osm_polygon Setting up table: planet_osm_roads Mid: Ram, scale=100

Reading in file: /home/avar/src/josm/Iceland.osm Processing: Node(272k) Way(14k) Relation(0k) Node stats: total(272267), max(439423937) Way stats: total(14589), max(37500161) Relation stats: total(318), max(168491)

Writing way(14k)

Writing rel(0k) Committing transaction for planet_osm_point Sorting data and creating indexes for planet_osm_point Committing transaction for planet_osm_line Committing transaction for planet_osm_roads Committing transaction for planet_osm_polygon Sorting data and creating indexes for planet_osm_roads Sorting data and creating indexes for planet_osm_polygon Sorting data and creating indexes for planet_osm_line Completed planet_osm_roads Completed planet_osm_point Completed planet_osm_polygon Completed planet_osm_line

Setting up mapnik to talk to PostGIS & render
Get the world-boundaries files:

http://wiki.openstreetmap.org/wiki/Mapnik#Rendering_with_Mapnik

ending up with something like this:

avar@aoeu:~/src/mapnik$ ls -l world_boundaries/ total 571516 -rw-r--r-- 1 avar avar  3461233 2007-03-10 10:05 builtup_area.dbf -rw-r--r-- 1 avar avar   279020 2007-03-10 10:05 builtup_area.index -rw-r--r-- 1 avar avar      513 2007-03-10 10:05 builtup_area.prj -rw-r--r-- 1 avar avar 13378292 2007-03-10 10:05 builtup_area.shp -rw-r--r-- 1 avar avar   291556 2007-03-10 10:05 builtup_area.shx -rw-r--r-- 1 avar avar    15440 2007-03-10 10:07 places.dbf -rw-r--r-- 1 avar avar      333 2007-03-10 10:07 places.prj -rw-r--r-- 1 avar avar     7128 2007-03-10 10:07 places.shp -rw-r--r-- 1 avar avar     2108 2007-03-10 10:07 places.shx -rw-r--r-- 1 avar avar  4542989 2009-05-14 14:58 processed_p.dbf -rw-r--r-- 1 avar avar  2122036 2009-05-14 14:58 processed_p.index -rw-r--r-- 1 avar avar 400105652 2009-05-14 14:58 processed_p.shp -rw-r--r-- 1 avar avar  3634388 2009-05-14 14:58 processed_p.shx -rw-r--r-- 1 avar avar  3072629 2009-07-10 04:01 shoreline_300.dbf -rw-r--r-- 1 avar avar  1330488 2009-07-10 04:01 shoreline_300.index -rw-r--r-- 1 avar avar 89619536 2009-07-10 04:01 shoreline_300.shp -rw-r--r-- 1 avar avar  2048476 2009-07-10 04:01 shoreline_300.shx -rw-r--r-- 1 avar avar  4145601 2007-03-09 11:31 world_bnd_m.dbf -rw-r--r-- 1 avar avar   250968 2007-09-09 19:28 world_bnd_m.index -rw-r--r-- 1 avar avar      355 2007-03-09 11:31 world_bnd_m.prj -rw-r--r-- 1 avar avar 48495316 2007-03-09 11:32 world_bnd_m.shp -rw-r--r-- 1 avar avar   249444 2007-03-09 11:32 world_bnd_m.shx -rw-r--r-- 1 avar avar   673969 2008-03-30 21:42 world_boundaries_m.dbf -rw-r--r-- 1 avar avar    86700 2008-03-30 21:48 world_boundaries_m.index -rw-r--r-- 1 avar avar      355 2008-03-30 21:51 world_boundaries_m.prj -rw-r--r-- 1 avar avar  6669352 2008-03-30 21:42 world_boundaries_m.shp -rw-r--r-- 1 avar avar    30556 2008-03-30 21:42 world_boundaries_m.shx

Then create the new osm.xml file:

avar@aoeu:~/src/mapnik/mapnik$ ./set-mapnik-env ./customize-mapnik-map > osm.xml avar@aoeu:~/src/mapnik/mapnik$