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

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

shortcut for installing database

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