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

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

Also refresh those shapefiles

  • Property svn:executable set to *
File size: 3.7 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://tile.openstreetmap.org/world_boundaries-spherical.tgz
23wget -N -nv http://hypercube.telascience.org/~kleptog/processed_p.zip
24wget -N -nv http://tileserv.openstreetmap.org/shoreline_300.tar.bz2
25
26echo "* Importing to Database"
27echo "- Shapefiles"
28cd $ROOT_PATH/data
29tar xzf world_boundaries-spherical.tgz
30unzip processed_p.zip
31mv coastlines/* world_boundaries/
32rmdir coastlines
33tar xjf shoreline_300.tar.bz2 -C world_boundaries
34
35echo "- prepare osm2pgsql"
36cd $SOFTWARE_PATH/osm2pgsql
37psql -d gis -c "drop database gisold"
38psql -d gis -c "drop database gisnew"
39psql -d gis -c "create database gisnew"
40psql -d gisnew -c "create language plpgsql"
41psql -d gisnew -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
42psql -d gisnew -f /usr/share/postgresql/8.3/contrib/_int.sql
43echo "= osm2pgsql"
44./osm2pgsql -c -s -m -d $DB_NAME ~/data/europe.osm.bz2
45echo "= osmosis"
46echo "- init db for osmosis"
47psql $DB_NAME < ~/src/pgsql_simple_schema.sql
48cd $ROOT_PATH/data/
49~skunkosm/software/osmosis-current/bin/osmosis --read-xml ~/data/europe.osm.bz2 --write-pgsql-dump
50cd pgimport
51echo "- drop unneeded geometry"
52cut -f1-3 nodes.txt > nodes1.txt
53mv nodes1.txt nodes.txt
54echo "- load db from osmosis"
55psql $DB_NAME < ~/src/pgsql_simple_load.sql
56
57echo "finished import - next preprocess"
58# read
59
60echo "* Preprocessing data"
61cd $ROOT_PATH
62for i in src/sql/*.sql ; do echo "Executing $i ..." ; psql $DB_NAME < $i ; done
63
64echo "=== Preprocessing finsished. Press key to continue"
65read
66
67echo "* SVN - Update style"
68svn update conf.php render/
69
70export DB_NAME=gis
71
72echo "* Update style-sheet"
73export TMPDIR="/osm/`whoami`-style/`date +%Y%m%d-%H%M`"
74mkdir -p $TMPDIR
75echo "BASE"
76echo "Layers"
77cd $ROOT_PATH/render
78./gen_rotate_img.php
79./gen_layer.php > base.mml
80cascadenik-compile.py $ROOT_PATH/render/base.mml > $ROOT_PATH/render/base.xml
81$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/base.xml
82echo "PT"
83cd $ROOT_PATH/render
84convert -background none img/src/stop_p_back.svg img/stop_p_back.png
85convert -background none img/src/stop_p_for.svg img/stop_p_for.png
86convert -background none img/src/stop_n_back.svg img/stop_n_back.png
87convert -background none img/src/stop_n_for.svg img/stop_n_for.png
88convert -background none img/src/stop.svg img/stop.png
89cascadenik-compile.py $ROOT_PATH/render/overlay_pt.mml > $ROOT_PATH/render/overlay_pt.xml
90$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_pt.xml
91./create_rotate_style
92echo "CH"
93cascadenik-compile.py $ROOT_PATH/render/overlay_ch.mml > $ROOT_PATH/render/overlay_ch.xml
94$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_ch.xml
95echo "CAR"
96cascadenik-compile.py $ROOT_PATH/render/overlay_car.mml > $ROOT_PATH/render/overlay_car.xml
97$ROOT_PATH/src/update_xml.pl $ROOT_PATH/render/overlay_car.xml
98echo "WIKI Style"
99cd $ROOT_PATH
100$ROOT_PATH/src/gen_mss_from_wiki.php
101
102echo "=== Updated Style. Press key to continue"
103read
104
105echo "* SVN - Updating rest of code"
106svn update
107
108killall renderd
109
110psql -d gisnew -c "alter database gis rename to gisold"
111psql -d gisold -c "alter database gisnew rename to gis"
112touch /osm/tiles/planet-import-complete
113
114cd $ROOT_PATH
115./software/mod_tile/mod_tile/renderd
Note: See TracBrowser for help on using the repository browser.