Created
September 20, 2012 14:40
-
-
Save hawx/3756320 to your computer and use it in GitHub Desktop.
Make large prettymap maps.
This file contains hidden or 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 sh | |
# | |
# Usage: prettymaker <start-row> <end-row> <start-col> <end-col> | |
# | |
# Prettymaker will pull map tiles from in the ranges specified at level 10 | |
# zoom from prettymaps.stamen.com and build a massive map. Each tile is | |
# 256x256px so fully created map may be large! | |
# | |
# Note: run this in an empty folder, it deletes stuff during processing and | |
# may catch items you didn't want deleted. | |
# | |
# Creates a row called XXX-row.png where XXX is $1, the row you wanted. | |
# | |
# opt [$1] row to get | |
# opt [$2] start position of row | |
# opt [$3] end position of row | |
function create_row() { | |
for i in `seq -w $2 $3`; do | |
wget http://prettymaps.stamen.com/201008/tiles/isola/10/000/$i/000/$1.png | |
done | |
mv $1.png $1.png.0 | |
s=`expr $3 - $2` | |
for i in `seq 0 $s`; do | |
mv $1.png.$i $i.png.yes | |
done | |
convert `ls *.png.yes | sort -g` +append $1-row.png | |
rm *.png.yes | |
} | |
# Creates a map called map.png using the arguments given. | |
# | |
# opt [$1] start row | |
# opt [$2] end row | |
# opt [$3] start column | |
# opt [$4] end column | |
function create_map() { | |
for row in `seq -w $1 $2`; do | |
create_row $row $3 $4 | |
done | |
convert *-row.png -append map.png | |
rm *-row.png | |
} | |
# eg. create_map 330 332 500 502 | |
create_map $1 $2 $3 $4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment