From: Andrew Lorimer Date: Wed, 21 Apr 2021 05:03:45 +0000 (+1000) Subject: add vicmap-montage.sh X-Git-Url: https://git.lorimer.id.au/scripts.git/diff_plain/ee9dc99fb582b2a01855f38a32da2da2d8531252 add vicmap-montage.sh --- diff --git a/vicmap-montage.sh b/vicmap-montage.sh new file mode 100755 index 0000000..44ea6c6 --- /dev/null +++ b/vicmap-montage.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Tool for downloading Vicmap Basemap aerial photography (provided as tiles) +# and combine into a single file. View maps and determine desired coordinates +# here - https://services.land.vic.gov.au/DELWPmaps/historical-photomaps/ +# (turn on "Vicmap Basemap - Aerial") + +# Andrew Lorimer - April 2021 + +usagelong="\e[1mUSAGE:\e[0m + $(basename "$0") LONGMIN LONGMAX LATMIN LATMAX [OUTPUT] + +\e[1mOPTIONS:\e[0m + LONGMIN + Minimum longitude + + LONGMAX + Maximum longitude + + LATMIN + Minimum latitude + + LATMAX + Maximum latitude + + OUTPUT + Name of file to output to (relative to current directory). Default: vicmap.png + + Inspect Element on map, then find the
with the satellite images (element + id varies). The second last number in each image URL corresponds to the longitude + (E-W) and the last number corresponds to the latitude (N-S). Find the maximum + latitude and longitude in the range shown.\n" + +longmin=473737 +longmax=473741 +latmin=321805 +latmax=321808 +output="vicmap.png" + +if (( $# < 4 || $# > 5)); then + printf "$usagelong" + exit +fi +longmin=$1 +longmax=$2 +latmin=$3 +latmax=$4 +if (( $# == 5 )); then + output=$5 +fi + +x=$(( $longmax - $longmin + 1)) +y=$(( $latmax - $latmin + 1)) + +mkdir -p .vicmap-tmp +cd .vicmap-tmp + +i=$longmin +# Iterate through longitudes (columns) +for ((i=$longmin; i<=$longmax; i++)); do + mkdir -p $i + # Iterate through latitudes (individual tiles N to S) + for ((j=$latmin; j<=$latmax; j++)); do + curl -s -C - https://base.maps.vic.gov.au/wmts/AERIAL_WM/EPSG:3857/20/$i/$j.png -o $i/$j.png + done + montage $i/* -tile 1x"$y" -geometry +0+0 $i.png +done + +montage *.png -tile "$x"x1 -geometry +0+0 ../$output + + +rm -rf .vicmap-tmp