source: subversion/applications/rendering/mapnik/install.txt @ 3201

Last change on this file since 3201 was 3201, checked in by joerg, 13 years ago

add worldboundary stuff to readme

File size: 4.1 KB
Line 
1# This is a start for an (almost) cut'n past installation description for mapnik-osm-renderer
2
3# ------ Install some stuff
4  sudo apt-get install \
5                build-essential libfreetype6-dev libltdl3-dev \
6                libpng12-dev  libtiff4-dev libboost-thread-dev\
7                libboost-filesystem-dev \
8                libboost-serialization-dev libboost-regex-dev\
9                libboost-python-dev  proj python-imaging scons \
10                libboost-program-options-dev postgresql-doc-8.1 \
11                postgresql-8.1 postgresql-8.1-plruby \
12                postgresql-client-8.1 postgresql-contrib-8.1\
13                postgresql-plperl-8.1 postgresql-plpython-8.1 \
14                postgresql-server-dev-8.1 postgresql-8.1-postgis \
15                libboost-python-dev python2.4-dev \
16                libwww-perl libxml-parser-perl libfile-slurp-perl \
17
18  # compile osmsql
19  (cd ~/svn.openstreetmap.org/applications/utils/export/osm2pgsql/; make)
20
21
22# ----------- Create Database and Grant rights
23
24  export user_name=`whoami`
25  # or with a different user. 'steve' is the example user here ;-)
26  export user_name="steve"
27  sudo -u postgres createdb -Upostgres  -EUTF8 gis
28  sudo -u postgres createuser -Upostgres -S -D -R \"$user_name\"
29  echo "GRANT ALL ON SCHEMA PUBLIC TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
30  sudo -u postgres createlang plpgsql gis
31  sudo -u postgres psql -Upostgres gis </usr/share/postgresql-8.1-postgis/lwpostgis.sql \
32     2>&1 | grep -v -e 'FEHLER:  aktuelle Transaktion' \
33     -e 'ERROR:  current transaction is aborted' \
34     -e 'CREATE FUNCTION' -e OPERATOR
35   echo "GRANT ALL on geometry_columns TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
36  echo "GRANT ALL on spatial_ref_sys TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
37  echo "GRANT ALL ON SCHEMA PUBLIC TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
38
39
40 
41 # ------- Get World Boundaries
42 # Download is (600MB)
43 # unpacking is an additional 1.2GB
44 wget http://artem.dev.openstreetmap.org/files/world_boundaries.tar.bz2 -O /tmp/world_boundaries.tar.bz2
45 mkdir -p /usr/share/mapnik
46 cd /usr/local/mapnik
47 tar -xvjf /tmp/world_boundaries.tar.bz2
48 
49# ---- Install and run planet-mirror --> planet.sql
50  # Get newest planet.osm. This will takes some time
51  ~/svn.openstreetmap.org/applications/utils/planet-mirror/planet-mirror.pl -v -d
52  export planet_name=`~/svn.openstreetmap.org/applications/utils/planet-mirror/planet-mirror.pl -print-filename`
53  echo "export planet_name='$planet_name'"
54
55#  ~/svn.openstreetmap.org/applications/utils/export/osm2pgsql/osm2pgsql $planet_name.gz
56
57  ~/svn.openstreetmap.org/applications/utils/export/osm2pgsql/osm2pgsql ~/osm/planet/planet-*.osm
58
59  # convert osm --> sql and import. takes about 45 minutes on a 2GHz (0.5GB-Ram) Machine
60  #                                             23 minutes on a 3GHz (2 GB-Ram) Machine
61  # Processing: Node(11420k)
62  # Processing: Segment(12080k)
63  # Processing: Way(726k)
64  # for Writing way(663k)
65
66
67  # Test if you can read the Database
68  echo "SELECT * from planet_osm_polygon LIMIT 2;" |  psql  gis -h /var/run/postgresql
69
70
71# From here on the cut'n paste part stops
72  cd ~/svn.openstreetmap.org/applications/rendering/mapnik/
73  vi convert
74  # then replace jburgess to your username
75
76  ./convert osm.xml > osm-local.xml
77
78  vi generate_tiles.py
79  vi osm.xml
80     and change the path to your installation:
81     /home/mapnik/
82
83  vi osm.xml
84   replace with your username:
85      <Parameter name="user">steve</Parameter>
86   replace /home/mapnik/ with your home-directory
87
88   set the host connection to your local machine:
89      <Parameter name="host">/var/run/postgresql</Parameter>
90
91   remove this for local connections:
92#      <Parameter name="port">5432</Parameter>
93
94
95vi ~/svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
96    replace with your area
97    bbox = (-2, 50.0,1.0,52.0)
98
99   mkdir -p ~/osm/tiles
100
101# ---------- And now, we start the rendering
102export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
103export PYTHONPATH=/usr/lib/python2.5/site-packages:/usr/share/pycentral/python-mapnik/site-packages
104python ~/svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
Note: See TracBrowser for help on using the repository browser.