summaryrefslogtreecommitdiff
path: root/convert
blob: d2bcc397632f67a4f9f7a7e2114ef68d5c230edd (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
#!/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/'
countries=(
  austria
  croatia
  czech-republic
  germany
  italy
  poland
  slovakia
  slovenia
)

[ -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'

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}"
    if [ -d "${baseNameDir}" ]
    then
      if ls "${baseNameDir}" | grep -q ''
      then
        rm "${baseNameDir}"/*
      fi
      rmdir "${baseNameDir}"
    fi
  fi

  baseName="${country}-latest.osm.pbf"
  baseNameDir="${country}-latest_dir"

  [ -d "${baseNameDir}" ] && continue

  mkdir "${baseNameDir}"
  (
    cd "${baseNameDir}"
    /usr/lib/jvm/java-8-openjdk/jre/bin/java -jar /usr/share/java/splitter/splitter.jar "../${baseName}"
  )
done

/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 \
  --index \
  --gmapsupp \
  *-latest_dir/6324????.osm.pbf