blob: abd139896093be2f8081c4702ecee00cd51e0dca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#!/bin/bash
set -e
if [ "$(basename "$(pwd)")" != "work" ]
then
>&2 echo 'You should call this script within a directory called "work".'
exit 1
fi
mainUrl='https://download.geofabrik.de/europe/'
case "$1" in
'')
area='groszdeutschland'
countries=(
austria
germany
italy
switzerland
)
;;
'benelux')
area='benelux'
countries=(
belgium
luxembourg
netherlands
)
;;
'fast')
area='thueringen'
mainUrl="${mainUrl}germany/"
countries=(
thueringen
)
;;
'gus')
area='gus'
countries=(
croatia
czech-republic
poland
slovakia
slovenia
)
;;
*)
>&2 printf 'Unknown option "%s".\n' "$1"
exit 1
;;
esac
numJobs=$(($(/usr/bin/getconf _NPROCESSORS_ONLN)/2))
if [ ${numJobs} -lt 1 ]
then
numJobs=1
fi
[ -f "sea.zip" ] || \
wget -nd 'http://osm2.pleiades.uni-wuppertal.de/sea/latest/sea.zip'
[ -f "bounds.zip" ] || \
wget -nd 'http://osm2.pleiades.uni-wuppertal.de/bounds/latest/bounds.zip'
needsRecompilation=false
nextId="63240001"
for country in "${countries[@]}"
do
baseName="${country}-latest.osm.pbf"
baseNameDir="${country}-latest_dir"
dlItem="${mainUrl}${baseName}"
if [ ! -e "${baseName}" ] || ! wget -O - "${dlItem}.md5" 2> /dev/null | md5sum -c
then
rm -f "${baseName}"
wget -nd "${dlItem}"
needsRecompilation=true
fi
if [ ! -d "${baseNameDir}" ]
then
needsRecompilation=true
fi
if ${needsRecompilation}
then
if [ -d "${baseNameDir}" ]
then
if ls "${baseNameDir}" | grep -q ''
then
rm "${baseNameDir}"/*
fi
rmdir "${baseNameDir}"
fi
mkdir "${baseNameDir}"
/usr/lib/jvm/java-8-openjdk/jre/bin/java -jar /usr/share/java/splitter/splitter.jar \
--output-dir="${baseNameDir}" \
--mapid="${nextId}" \
"${baseName}"
fi
nextId=$[
$(
ls -1 "${baseNameDir}" | \
grep '^6324....\.osm\.pbf$' | \
cut -d. -f1 | \
sort -n | \
tail -n1
)
+1
]
done
if [ ! -d mkgmap-style-sheets ]
then
git clone 'https://github.com/ligfietser/mkgmap-style-sheets.git'
needsRecompilation=true
fi
git -C mkgmap-style-sheets fetch --all -p
if [ "$(git -C mkgmap-style-sheets rev-parse origin/HEAD)" != "$(git -C mkgmap-style-sheets rev-parse HEAD)" ]
then
git -C mkgmap-style-sheets checkout master
git -C mkgmap-style-sheets reset --hard origin/master
needsRecompilation=true
fi
if ${needsRecompilation}
then
nice /usr/lib/jvm/java-8-openjdk/jre/bin/java -jar /usr/share/java/mkgmap/mkgmap.jar \
--route \
--add-pois-to-lines \
--add-pois-to-areas \
--bounds=bounds.zip \
--precomp-sea=sea.zip \
--generate-sea \
--index \
--gmapsupp \
--family-name="OpenStreetmap mkgmap" \
--area-name="${area}" \
--max-jobs="${numJobs}" \
--remove-ovm-work-files \
--style-file=mkgmap-style-sheets/styles \
--style="generic new" \
"mkgmap-style-sheets/typ/osm generic new/2000.typ" \
$(
printf '%s-latest_dir/6324????.osm.pbf\n' "${countries[@]}"
)
rm -f 6324????.img
fi
size=$(stat -c '%s' gmapsupp.img)
max_size=$((4*1024*1024*1024))
{
printf '%s\n' \
'To: benachrichtigungen@eckner.net' \
'From: plasmapaule@gmail.com' \
'Subject: Karte fertig' \
'' \
'Deine Karte auf '"$(hostname)"' ist fertig!'
if [ ${size} -gt ${max_size} ]; then
printf '%s\n' \
'Die ist aber groeszer als 4GB.'
fi
} | \
sendmailadvanced -t
|