Skip to content

Instantly share code, notes, and snippets.

@adamnoffie
Created June 14, 2016 19:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamnoffie/98ea29fe41a5384a8738a6410c94e7d9 to your computer and use it in GitHub Desktop.
Save adamnoffie/98ea29fe41a5384a8738a6410c94e7d9 to your computer and use it in GitHub Desktop.
# original idea from http://gis.stackexchange.com/questions/73946/automatically-download-and-merge-webmap-tiles-into-one-big-image
# pre-requisite: imagemagick
# ( e.g. sudo apt-get imagemagick )
X1=0
Y1=0
X2=9
Y2=13
Z=4
for x in `seq $X1 $X2`; do
for y in `seq $Y1 $Y2`; do
echo "Getting ${x},${y}"
# padding is necessary because image filename alphabetical ordering is important for montage command
imgfile=${Z}_$(printf %03d ${y})_$(printf %03d ${x}).jpg
#URL to pull images from
curl -s https://www.nps.gov/maps/hfc/park-maps/iatr/brochure-map/TileGroup0/${Z}-${x}-${y}.jpg -o ${imgfile}.jpg &
done
wait
done
# the -tile param here is only being passed the x, and derives the y from the number of images
# see http://www.imagemagick.org/Usage/montage/
montage -mode concatenate -tile "$((X2-X1+1))x" "${Z}_*.jpg" iceagetrailmap_${Z}.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment