From 2341bf83d5da70fc9d64ee529619905187e15973 Mon Sep 17 00:00:00 2001 From: Andrew Lorimer Date: Tue, 14 Jun 2022 15:46:59 +1000 Subject: [PATCH] add zoom level argument to vicmap-montage.sh --- vicmap-montage.sh | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/vicmap-montage.sh b/vicmap-montage.sh index 44ea6c6..12b760b 100755 --- a/vicmap-montage.sh +++ b/vicmap-montage.sh @@ -2,13 +2,13 @@ # 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/ +# here - https://mapshare.vic.gov.au/webmap/historical-photomaps/ # (turn on "Vicmap Basemap - Aerial") # Andrew Lorimer - April 2021 usagelong="\e[1mUSAGE:\e[0m - $(basename "$0") LONGMIN LONGMAX LATMIN LATMAX [OUTPUT] + $(basename "$0") LONGMIN LONGMAX LATMIN LATMAX [[ZOOM] OUTPUT] \e[1mOPTIONS:\e[0m LONGMIN @@ -23,30 +23,39 @@ usagelong="\e[1mUSAGE:\e[0m LATMAX Maximum latitude + ZOOM + The zoom level for tiles, 1-20. Zoom 5 captures the whole state in one + 512x512px tile. Zoom 20 produces 62.44m square tiles at 512x512px. Note + coordinates change between zoom levels - the coordinates for the north west + corner of each tile are multiplied by two for each increment in zoom level. + This accounts for each tile splitting into 4 (i.e. doubling the scale). + Default: 20 + OUTPUT - Name of file to output to (relative to current directory). Default: vicmap.png + 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" + id typically OpenLayers_Layer_XYZ_8). 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" -if (( $# < 4 || $# > 5)); then +if (( $# < 4 || $# > 6)); then printf "$usagelong" exit fi +zoom="20" +output="vicmap.png" + longmin=$1 longmax=$2 latmin=$3 latmax=$4 if (( $# == 5 )); then output=$5 +elif (( $# == 6)); then + zoom=$5 + output=$6 fi x=$(( $longmax - $longmin + 1)) @@ -55,18 +64,17 @@ 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 + curl -s -C - https://base.maps.vic.gov.au/wmts/AERIAL_WM/EPSG:3857/$zoom/$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 - +cd .. rm -rf .vicmap-tmp -- 2.47.0