Automatically download and merge webmap tiles into one big image?

Ok, in the end this script did the job:

X1=456
Y1=307
X2=469
Y2=316
Z=9
for x in `seq $X1 $X2`; do
for y in `seq $Y1 $Y2`; do
echo "Getting ${x},${y}"
curl -s http://localhost:20008/tile/SteveCountryVic/${Z}/${x}/${y}.png -o ${Z}_${y}_${x}.png &
done
wait
done
montage -mode concatenate -tile "$((X2-X1+1))x" "${Z}_*.png" out_z${Z}_${X1}_${Y1}-${X2}_${Y2}.png

The only hassle is working out the values of X1,X2,Y1,Y2. Install imagemagick first:

sudo apt-get install imagemagick

I have successfully used taho.exe for such things. You can learn more about it from here:

http://www.dimitri-junker.de/eng/html/openstreetmap.html

You can change the source URL manually to fit your needs; even local addresses with file:/// will do.

You can switch the language to English under Bearbeiten -> Optionen. An English help manual is included in the Docu folder.

The programme DYJtracks from the same author and the same download page is a bit more comfortable to get a single map, and works even without a gpx file. But I don't know if you can get it running under Linux using wine.


Here's another option: https://github.com/ericfischer/tile-stitch

It's a simple command line tool where you specify the desired zoom level along with a bounding box or a center point w/ desired output dimensions in pixels.

The install instructions assume linux, but it compiled easily for me on OSX.