#!/bin/tcsh

# google coordinates of the quadrants to get
set xmin = 2405
set ymin = 3035
set xmax = 2426
set ymax = 3068

set string = "(($xmax - $xmin + 1)*($ymax - $ymin + 1))";
set total = `perl -e "print $string"`
set current = 0
set y = $ymin
set yr = 0
echo "" > map.html
while($y <= $ymax)
    set x = $xmin
    set xr = 0
    while($x <= $xmax)
        # if you uncomment the below the script will only get the outline
        # this is useful for getting the right coordinates
        #
        # if($x == $xmin || $x == $xmax || $y == $ymin || $y == $ymax) then
            wget -q -O "map$xr-$yr.png" "http://mt.google.com/mt?v=w2.5&x=$x&y=$y&zoom=4"
        # endif
        printf "<img src='map$xr-$yr.png'>" >> map.html
        echo "$current / $total"
        @ x++
        @ xr++
        @ current++
    end
    printf "<br>" >> map.html
    @ y++
    @ yr++
end

