summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-02-14 12:23:05 +0100
committerErich Eckner <git@eckner.net>2017-02-14 12:23:05 +0100
commit9d53dc55df11caf68faa275a20e093f61d74f46b (patch)
tree5f8504badef53dc67f0d1703514a0abad640b3ab
downloadosm-to-garmin-9d53dc55df11caf68faa275a20e093f61d74f46b.tar.xz
Initial commit
-rwxr-xr-xconvert65
1 files changed, 65 insertions, 0 deletions
diff --git a/convert b/convert
new file mode 100755
index 0000000..65302ee
--- /dev/null
+++ b/convert
@@ -0,0 +1,65 @@
+#!/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
+ czech-republic
+ germany
+ italy
+ poland
+ slovakia
+)
+
+[ -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