Skip to content

Instantly share code, notes, and snippets.

@sirleech
Created February 8, 2012 05:10
Show Gist options
  • Save sirleech/1765615 to your computer and use it in GitHub Desktop.
Save sirleech/1765615 to your computer and use it in GitHub Desktop.
Mapnik Rendering System on Ubuntu 11.10 Installation

Install Postgres and Postgis

sudo apt-get install postgresql-9.1 pgadmin3 postgresql-contrib postgis postgresql-9.1-postgis

Set password for user Postgres

sudo su postgres
psql
\password postgres
\q

Set Up PostGIS

sudo su postgres
psql -c "create role gisgroup;"
createdb -E UTF8 template_postgis
createlang -d template_postgis plpgsql
psql -d template_postgis < /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
psql -d template_postgis < /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
psql -c "alter table geometry_columns owner to gisgroup;" template_postgis
psql -c "alter table spatial_ref_sys owner to gisgroup;" template_postgis

Using PostGIS

psql -c "create user usernamewhatever with password 'itsasecret';"
psql -c "grant gisgroup to usernamewhatever;”
createdb -T template_postgis -O usernamewhatever yourdbname

osm2pgsql

Install

sudo apt-get install osm2pgsql

Copy default.style

cd /usr/share
sudo wget http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/default.style

Import australia.osm into postgis

osm2pgsql -H 'localhost' -d 'yourdbname' -U 'usernamewhatever' -W australia.osm

Mapnik

Install Mapnik2 from source

Gist

Mapnik Tools

svn export http://svn.openstreetmap.org/applications/rendering/mapnik

Download World Boundaries

cd mapnik
wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz # (50 MB)
wget http://tile.openstreetmap.org/processed_p.tar.bz2 # (357 MB)
wget http://tile.openstreetmap.org/shoreline_300.tar.bz2 # (46 MB)
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/10m/cultural/10m-populated-places.zip # (1.5 MB)
wget http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/110m-admin-0-boundary-lines.zip # (38 KB)

tar xzf world_boundaries-spherical.tgz
tar xjf processed_p.tar.bz2 -C world_boundaries
tar xjf shoreline_300.tar.bz2 -C world_boundaries
unzip 10m-populated-places.zip -d world_boundaries
unzip 110m-admin-0-boundary-lines.zip -d world_boundaries

Configure Mapnik Tools

./generate_xml.py --host localhost --user 'usernamewhatever' --dbname 'yourdbname' --port 5432 --password 'itsasecret'

Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment