Andrew's git
/
scripts.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
add zoom level argument to vicmap-montage.sh
author
Andrew Lorimer
<andrew@lorimer.id.au>
Tue, 14 Jun 2022 05:46:59 +0000
(15:46 +1000)
committer
Andrew Lorimer
<andrew@lorimer.id.au>
Tue, 14 Jun 2022 05:46:59 +0000
(15:46 +1000)
vicmap-montage.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
a9a8468
)
diff --git
a/vicmap-montage.sh
b/vicmap-montage.sh
index 44ea6c613d88f28b5e820ecf32e8810406e27a4f..12b760b04aec19d67f26d546e03d37d6f33dd664 100755
(executable)
--- 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
# 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
# (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
\e[1mOPTIONS:\e[0m
LONGMIN
@@
-23,30
+23,39
@@
usagelong="\e[1mUSAGE:\e[0m
LATMAX
Maximum latitude
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
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 <div> with the satellite images (element
Inspect Element on map, then find the <div> 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
printf "$usagelong"
exit
fi
+zoom="20"
+output="vicmap.png"
+
longmin=$1
longmax=$2
latmin=$3
latmax=$4
if (( $# == 5 )); then
output=$5
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))
fi
x=$(( $longmax - $longmin + 1))
@@
-55,18
+64,17
@@
y=$(( $latmax - $latmin + 1))
mkdir -p .vicmap-tmp
cd .vicmap-tmp
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
# 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
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
rm -rf .vicmap-tmp