Created
May 18, 2018 04:32
-
-
Save remyroy/0f3a5797d5b92cb150f1b28b195cbb4d to your computer and use it in GitHub Desktop.
Create Garmin maps from OSM+SRTM data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# MAPID and CMAPID must be unique, my Garmin device only loads 1 | |
MAPID=5121 | |
CMAPID=5131 | |
REMOTEPBF=new-hampshire-latest.osm.pbf | |
REMOTEPBFURL=https://download.geofabrik.de/north-america/us/$REMOTEPBF | |
REMOTEPOLY=new-hampshire.poly | |
REMOTEPOLYURL=https://download.geofabrik.de/north-america/us/$REMOTEPOLY | |
MAPDESCRIPTION="New Hampshire" | |
mkdir data | |
pushd data > /dev/null | |
rm -f $REMOTEPBF | |
wget "$REMOTEPBFURL" | |
rm -f ${MAPID}*.pbf | |
java -jar $SPLITTERJAR \ | |
--precomp-sea=$SEA "$(pwd)/${REMOTEPBF}" \ | |
--mapid=${MAPID}0001 | |
DATA="$(pwd)/${MAPID}*.pbf" | |
popd > /dev/null | |
mkdir data2 | |
pushd data2 > /dev/null | |
rm -f $REMOTEPOLY | |
wget "$REMOTEPOLYURL" | |
rm -f phyghtmap-out*.pbf | |
phyghtmap --polygon=$REMOTEPOLY -j 2 -s 10 -0 --source=view3 \ | |
--max-nodes-per-tile=0 --max-nodes-per-way=0 --pbf -o phyghtmap-out | |
PHYGHTMAPPBF=`find . -type f -name "phyghtmap-out*" -print` | |
DEMPATH="$(pwd)/hgt/VIEW3" | |
rm -f ${CMAPID}*.pbf | |
java -jar $SPLITTERJAR $PHYGHTMAPPBF --mapid=${CMAPID}0001 | |
DATA2="$(pwd)/${CMAPID}*.pbf" | |
popd > /dev/null | |
OPTIONS="$(pwd)/opentopomap_options" | |
OPTIONS2="$(pwd)/contours_options" | |
STYLEFILE="$(pwd)/style/opentopomap" | |
STYLEFILE2="$(pwd)/style/contours" | |
pushd style/typ > /dev/null | |
java -jar $MKGMAPJAR --family-id=35 OpenTopoMap.txt | |
TYPFILE="$(pwd)/OpenTopoMap.typ" | |
TYPFILE2="$(pwd)/contours.typ" | |
popd > /dev/null | |
java -Xmx4g -jar $MKGMAPJAR -c $OPTIONS --style-file=$STYLEFILE \ | |
--precomp-sea=$SEA \ | |
--description="$MAPDESCRIPTION - OTM" \ | |
--series-name="$MAPDESCRIPTION - OTM" \ | |
--mapname=${MAPID}0001 \ | |
--dem=$DEMPATH \ | |
--overview-dem-dist=110000 \ | |
--dem-dists=13248,26512,53024,106048,212096,424192,848384,1696768,3393536 \ | |
--output-dir=output --bounds=$BOUNDS $DATA $TYPFILE | |
cp $TYPFILE output/xOpenTopoMap.typ | |
java -jar $MKGMAPJAR -c $OPTIONS2 --style-file=$STYLEFILE2 \ | |
--description="$MAPDESCRIPTION - OTM - Contours" \ | |
--series-name="$MAPDESCRIPTION - OTM - Contours" \ | |
--mapname=${CMAPID}0001 \ | |
--output-dir=output2 $DATA2 $TYPFILE2 | |
cp $TYPFILE2 output2/xcontours.typ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment