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

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

add dependency libgeos-dev for compilation

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