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

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

update description for postgress 8.2, update description to get
simpler using new planet-mirror

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