source: subversion/utils/mapnik/install.txt @ 2364

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

add more dependencies

File size: 5.5 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                libtimedate-perl libdate-manip-perl imagemagick \
18                libavl-dev
19  sudo apt-get install \
20                ttf-arabeyes \
21                ttf-arphic-ukai \
22                ttf-arphic-uming \
23                ttf-thai-tlwg \
24                ttf-devanagari-fonts
25  sudo apt-get install \
26                ttf-dejavu
27
28# ---- get software from OSM-SVN and compile
29  cd
30  svn co http://svn.openstreetmap.org/
31
32  # compile UTF8sanitize
33  ( cd ~/svn.openstreetmap.org/utils/planet.osm/C; make)
34  # compile osmsql
35  (cd ~/svn.openstreetmap.org/utils/osm2pgsql/; make)
36
37# ---- Install mapnik
38  cd ~/svn.openstreetmap.org/utils/mapnik.berlios
39  python scons/scons.py
40  sudo python scons/scons.py install
41  sudo python scons/scons.py PGSQL_INCLUDES=/usr/include/postgresql \
42       PGSQL_LIBS=/usr/lib/postgresql/8.1/lib install
43
44
45# ----------- Create Database and Grant rights
46
47  export user_name=`whoami`
48  # or with a different user. 'steve' is the example user here ;-)
49  export user_name="steve"
50  export user_name="mapnik"
51  sudo -u postgres createdb -Upostgres  -EUTF8 mapnik
52  sudo -u postgres createuser -Upostgres -S -D -R $user_name
53  echo "GRANT ALL ON SCHEMA PUBLIC TO $user_name;" | sudo -u postgres psql -Upostgres mapnik
54  sudo -u postgres createlang plpgsql mapnik
55  sudo -u postgres psql -Upostgres mapnik </usr/share/postgresql-8.1-postgis/lwpostgis.sql \
56     2>&1 | grep -v -e 'FEHLER:  aktuelle Transaktion' \
57     -e 'ERROR:  current transaction is aborted' \
58     -e 'CREATE FUNCTION' -e OPERATOR
59
60
61  echo "GRANT ALL on geometry_columns TO $user_name;" | sudo -u postgres psql -Upostgres mapnik
62  echo "GRANT ALL on spatial_ref_sys TO $user_name;" | sudo -u postgres psql -Upostgres mapnik
63  echo "DROP TABLE planet_osm ;" | sudo -u postgres psql -Upostgres mapnik
64  echo "CREATE TABLE planet_osm (   osm_type    char(1),
65       osm_id      bigint,   name        text,   place       text,   landuse     text,
66       leisure     text,   waterway    text,   highway     text,   amenity     text,
67       tourism     text,   learning    text);" | sudo -u postgres psql -Upostgres mapnik
68  echo "SELECT AddGeometryColumn('planet_osm', 'way', 4326, 'GEOMETRY', 2);" | sudo -u postgres psql -Upostgres mapnik
69  echo "ALTER TABLE planet_osm ADD CONSTRAINT pk__planet_osm PRIMARY KEY (osm_type, osm_id);" | sudo -u postgres psql -Upostgres mapnik
70  echo "CREATE INDEX planet_spatial_idx ON planet_osm USING gist (way GIST_GEOMETRY_OPS);" | sudo -u postgres psql -Upostgres mapnik
71  echo "GRANT ALL ON SCHEMA PUBLIC TO $user_name;" | sudo -u postgres psql -Upostgres mapnik
72  echo "GRANT ALL ON TABLE planet_osm TO $user_name;" | sudo -u postgres psql -Upostgres mapnik
73
74 
75# ---- Install and run planet-mirror --> planet.sql
76  # Get newest planet.osm. This will takes some time
77  ~/svn.openstreetmap.org/utils/planet-mirror/planet-mirror.pl -v
78  bunzip2 --keep `~/svn.openstreetmap.org/utils/planet-mirror/planet-mirror.pl -print-filename`
79  export planet_name=`~/svn.openstreetmap.org/utils/planet-mirror/planet-mirror.pl -print-filename`
80  echo "export planet_name='$planet_name'"
81  # convert osm --> sql. takes about 10 minutes on a 3GHz (2GB-Ram) Machine
82  date; time ~/svn.openstreetmap.org/utils/osm2pgsql/osm2pgsql $planet_name > $planet_name.sql
83
84  # Now we need the result from the osm2pgsql command
85  export planet_name=`~/svn.openstreetmap.org/utils/planet-mirror/planet-mirror.pl -print-filename`
86  date;time sudo -u postgres psql -Upostgres mapnik  <${planet_name}.sql |\
87                 grep -v 'INSERT 0 1' | tee ~/insert.log
88  # takes about 10 minutes on a 3GHz  (2GB-Ram) machine
89
90  # Test if you can read the Database
91  echo "SELECT * from planet_osm LIMIT 5;" |  psql  mapnik -h /var/run/postgresql -p 5433
92
93
94# From here on the cut'n paste part stops
95
96vi ~/svn.openstreetmap.org/utils/mapnik/generate_tiles.py
97vi ~/svn.openstreetmap.org/utils/mapnik/osm.xml
98and change the path to your installation:
99 /home/mapnik/
100
101vi ~/svn.openstreetmap.org/utils/mapnik/osm.xml
102   replace with your username:
103      <Parameter name="user">steve</Parameter>
104   replace /home/mapnik/ with your home-directory
105
106   set the host connection to your local machine:
107      <Parameter name="host">/var/run/postgresql</Parameter>
108
109   remove this for local connections:
110#      <Parameter name="port">5432</Parameter>
111
112
113vi ~/svn.openstreetmap.org/utils/mapnik/generate_tiles.py
114    replace with your area
115    bbox = (-2, 50.0,1.0,52.0)
116
117
118# ---------- And now, we start the rendering
119export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
120python ~/svn.openstreetmap.org/utils/mapnik/generate_tiles.py
121
122# ---------- Upload the tiles-output to dev.openstreetmap.org or  mail a tar file to steve
123rsync --size-only -r -e ssh ~/osm/tiles dev.openstreetmap.org:
Note: See TracBrowser for help on using the repository browser.