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

Last change on this file since 17224 was 6908, checked in by jonb, 12 years ago

mapnik: Update install.txt to match the new procedure for importing the coastline. Update time estimates to match the new post-TIGER dataset

File size: 5.2 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 (50MB)
27 wget http://tile.openstreetmap.org/world_boundaries-spherical.tgz -O /tmp/world_boundaries-spherical.tgz
28 sudo mkdir -p /usr/share/mapnik
29 cd /usr/share/mapnik
30 sudo tar -xvzf /tmp/world_boundaries-spherical.tgz
31
32 # ------- Get new coastline data
33 # Download is around 200MB
34 # updated every few days. To see a map of the current data visit:
35 # http://tile.openstreetmap.nl/coastlines.html
36 wget http://hypercube.telascience.org/~kleptog/processed_p.zip -O /tmp/processed_p.zip
37 cd /usr/share/mapnik
38 sudo unzip /tmp/processed_p.zip
39
40
41# ----------- Create Database and Grant rights
42
43  export user_name=`whoami`
44  # or with a different user. 'steve' is the example user here ;-)
45  export user_name="steve"
46  sudo -u postgres createdb -Upostgres  -EUTF8 gis
47
48
49# if you want to do it yourself ....
50  sudo -u postgres createuser -Upostgres -S -D -R "$user_name"
51  echo "GRANT ALL ON SCHEMA PUBLIC TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
52  sudo -u postgres createlang plpgsql gis
53  sudo -u postgres psql -Upostgres gis </usr/share/postgresql-8.2-postgis/lwpostgis.sql \
54     2>&1 | grep -v -e 'FEHLER:  aktuelle Transaktion' \
55     -e 'ERROR:  current transaction is aborted' \
56     -e 'CREATE FUNCTION' -e OPERATOR
57   echo "GRANT ALL on geometry_columns TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
58  echo "GRANT ALL on spatial_ref_sys TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
59  echo "GRANT ALL ON SCHEMA PUBLIC TO \"$user_name\";" | sudo -u postgres psql -Upostgres gis
60
61 # else
62  wget http://www.gpsdrive.de/osm/mapnik-osm-gis.sql.gz -O \
63          ~/osm/mapnik-osm-gis.sql.gz
64  sed "s/tweety/$user_name/g" < ~/osm/mapnik-osm-gis.sql.gz | \
65          sudo -u postgres psql -Upostgres gis   
66
67# --------- Import coastline data into a new PostGIS table
68
69  cd /usr/share/mapnik/processed_p
70  shp2pgsql -s 900913 -I -g way processed_p shoreline_a | sudo -u postgres psql -Upostgres gis
71  echo "ALTER TABLE shoreline_a ALTER COLUMN way SET NOT NULL;" | sudo -u postgres psql -Upostgres gis
72  echo "CLUSTER shoreline_a_way_gist ON shoreline_a;" | sudo -u postgres psql -Upostgres gis
73  echo "GRANT SELECT ON shoreline_a TO public;" | sudo -u postgres psql -Upostgres gis
74
75# ---- Install and run planet-mirror --> planet.sql
76  # Get newest planet.osm. This will takes some time
77  ~/svn.openstreetmap.org/applications/utils/planet-mirror/planet-mirror.pl -v -v
78
79  ~/svn.openstreetmap.org/applications/utils/export/osm2pgsql/osm2pgsql ~/osm/planet/planet.osm.bz2
80  # convert osm --> sql and import.
81  #
82  # The planet file has grown considerably in recent months and the import
83  # will take at least a few hours even on a fast machine. The OSM tilegen
84  # machine currently takes 7 hours for the complete import.
85  #
86  # Processing: Node(13090k)
87  # Processing: Segment(13090k)
88  # Processing: Way(882k)
89  # Writing way(882k)
90
91  # The output will appear to stop at this point while PostgreSQL adds the
92  # indexes and re-organises the data on disk. This will probably take a
93  # couple of hours of intense disk IO to complete.
94
95  # Test if you can read the Database
96  echo "SELECT * from planet_osm_polygon LIMIT 2;" |  psql  gis -h /var/run/postgresql
97
98# From here on the cut'n paste part stops
99  cd ~/svn.openstreetmap.org/applications/rendering/mapnik/
100  vi set-mapnik-env
101  # edit all the stuff in there, see the comments in the file
102
103  # read in the env variables you have just defined
104  source set-mapnik-env
105
106  # convert osm-template.xml to local osm.xml file
107  ./customize-mapnik-map >$MAPNIK_MAP_FILE
108
109  # create the directory that will hold the tiles
110  mkdir -p $MAPNIK_TILE_DIR
111
112#------------
113# you can optionally change the bounding boxes and zoom levels you are
114# interested in in generate_tiles.py and generate_image.py
115#vi ~/svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
116#    replace with your area
117#    bbox = (-2, 50.0,1.0,52.0)
118#------------
119
120
121# ---------- And now, we start the rendering
122export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
123export PYTHONPATH=/usr/lib/python2.5/site-packages:/usr/share/pycentral/python-mapnik/site-packages
124python ~/svn.openstreetmap.org/applications/rendering/mapnik/generate_tiles.py
Note: See TracBrowser for help on using the repository browser.