source: subversion/sites/www.openstreetbrowser.org/do_all_live @ 28403

Last change on this file since 28403 was 19919, checked in by skunk, 10 years ago

Generate style for overlay Agriculture & Industry

  • Property svn:executable set to *
File size: 4.3 KB
Line 
1#!/bin/bash
2
3# This script is used in the live database
4# The import happens in a new database called 'gisnew'
5# When everything is finished the old database 'gis' is renamed to 'gisold' (in
6# case something went wrong, it can be drop later or when do_all_live is called
7# the next time) and 'gisnew' renamed to 'gis'
8
9export ROOT_PATH=/osm/osm
10export SOFTWARE_PATH=/osm/osm/software
11export DB_NAME=gisnew
12
13echo "=== Starting Database reload. Press key to continue."
14read
15
16echo "* SVN - Update database import"
17svn update src/
18
19echo "* Download new OSM-File"
20cd $ROOT_PATH/data
21wget -N http://download.geofabrik.de/osm/europe.osm.bz2
22wget -N -nv http://hypercube.telascience.org/~kleptog/processed_p.zip
23wget -N -nv http://tileserv.openstreetmap.org/shoreline_300.tar.bz2
24
25echo "* Importing to Database"
26echo "- Shapefiles"
27cd $ROOT_PATH/data
28mkdir world_boundaries/
29unzip processed_p.zip
30mv coastlines/* world_boundaries/
31rmdir coastlines
32tar xjf shoreline_300.tar.bz2 -C world_boundaries
33
34echo "- prepare osm2pgsql"
35cd $SOFTWARE_PATH/osm2pgsql
36psql -d gis -c "drop database gisold"
37psql -d gis -c "drop database gisnew"
38psql -d gis -c "create database gisnew"
39psql -d gisnew -c "create language plpgsql"
40psql -d gisnew -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
41psql -d gisnew -f /usr/share/postgresql/8.3/contrib/_int.sql
42echo "= osm2pgsql"
43./osm2pgsql -c -s -m -d $DB_NAME -S $ROOT_PATH/render/osm2pgsql.style ~/data/europe.osm.bz2
44echo "= osmosis"
45echo "- init db for osmosis"
46psql $DB_NAME < ~/src/pgsql_simple_schema.sql
47cd $ROOT_PATH/data/
48~skunkosm/software/osmosis-current/bin/osmosis --read-xml ~/data/europe.osm.bz2 --write-pgsql-dump
49cd pgimport
50echo "- drop unneeded geometry"
51cut -f1-3 nodes.txt > nodes1.txt
52mv nodes1.txt nodes.txt
53echo "- load db from osmosis"
54psql $DB_NAME < ~/src/pgsql_simple_load.sql
55
56echo "finished import - next preprocess"
57# read
58
59echo "* Preprocessing data"
60cd $ROOT_PATH
61for i in src/sql/*.sql ; do echo "Executing $i ..." ; psql $DB_NAME < $i ; done
62
63echo "=== Preprocessing finsished. Press key to continue"
64read
65
66echo "* SVN - Update style"
67svn update conf.php render/
68
69echo "List"
70php $ROOT_PATH/src/wiki_data_conf.php
71php src/wiki_create_indexes.php | psql $DB_NAME
72
73export DB_NAME=gis
74
75echo "* Update style-sheet"
76export TMPDIR="/osm/`whoami`-style/`date +%Y%m%d-%H%M`"
77mkdir -p $TMPDIR
78echo "WIKI Style"
79cd $ROOT_PATH
80$ROOT_PATH/src/gen_mss_from_wiki.php
81echo "BASE"
82echo "Layers"
83cd $ROOT_PATH/render
84./gen_rotate_img.php
85./gen_layer.php > base.mml
86cascadenik-compile.py $ROOT_PATH/render/base.mml > $ROOT_PATH/render/base.xml
87$ROOT_PATH/src/update_xml $ROOT_PATH/render/base.xml
88echo "PT"
89cd $ROOT_PATH/render/img/rotate/src
90for i in *.svg ; do convert -background none $i ../`echo $i | sed "s/svg$/png/"` ; done
91cd $ROOT_PATH/render
92cascadenik-compile.py $ROOT_PATH/render/overlay_pt.mml > $ROOT_PATH/render/overlay_pt.xml
93$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_pt.xml
94./create_rotate_style
95echo "CH"
96cascadenik-compile.py $ROOT_PATH/render/overlay_ch.mml > $ROOT_PATH/render/overlay_ch.xml
97$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_ch.xml
98echo "CAR"
99render/gen_mml.php $ROOT_PATH/render/overlay_car > $ROOT_PATH/render/overlay_car_compiled.mml
100cascadenik-compile.py $ROOT_PATH/render/overlay_car_compiled.mml > $ROOT_PATH/render/overlay_car.xml
101$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_car.xml
102
103echo "Other"
104cp $ROOT_PATH/render/overlay_services.template $ROOT_PATH/render/overlay_services.xml
105$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_services.xml
106
107cp $ROOT_PATH/render/overlay_culture.template $ROOT_PATH/render/overlay_culture.xml
108$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_culture.xml
109
110cp $ROOT_PATH/render/overlay_food.template $ROOT_PATH/render/overlay_food.xml
111$ROOT_PATH/src/update_xml $ROOT_PATH/render/overlay_food.xml
112
113cp $ROOT_PATH/render/shop.template $ROOT_PATH/render/shop.xml
114$ROOT_PATH/src/update_xml $ROOT_PATH/render/shop.xml
115
116cp $ROOT_PATH/render/agri_ind.template $ROOT_PATH/render/agri_ind.xml
117$ROOT_PATH/src/update_xml $ROOT_PATH/render/agri_ind.xml
118
119echo "=== Updated Style. Press key to continue"
120read
121
122echo "* SVN - Updating rest of code"
123svn update
124
125killall renderd
126
127psql -d gisnew -c "alter database gis rename to gisold"
128psql -d gisold -c "alter database gisnew rename to gis"
129touch /osm/tiles/planet-import-complete
130
131cd $ROOT_PATH
132./software/mod_tile/mod_tile/renderd
Note: See TracBrowser for help on using the repository browser.