Index: scripts/gpsfetchmap.pl =================================================================== --- scripts/gpsfetchmap.pl (revision 1496) +++ scripts/gpsfetchmap.pl (working copy) @@ -34,6 +34,7 @@ modified (May 2005) by Olli Salonen modified (Jul 2005) by Jaroslaw Zachwieja modified (Dec 2005) by David Pollard +modified (Jul 2007) by Maciek Kaliszewski Version svn-$Version "; @@ -158,6 +159,23 @@ 5000000 => 5000*6.4, 10000000 =>10000*6.4, 50000000 =>50000*6.4, + }, + googlemap => { + 64768000 => 15, + 32384000 => 14, + 16192000 => 13, + 8096000 => 12, + 4048000 => 11, + 2024000 => 10, + 1012000 => 9, + 506000 => 8, + 253000 => 7, + 126500 => 6, + 63250 => 5, + 31625 => 4, + 15812 => 3 , + 7906 => 2, + 3953 => 1 } }; @@ -258,6 +276,7 @@ sub expedia_url($$$); # {} sub geoscience_url($$$); # {} sub landsat_url($$$); # {} +sub googlemap_url($$$); # {} sub resize($$); #{} sub file_count($); # {} sub get_coords_for_route; # {} @@ -677,6 +696,10 @@ { ($url,$mapscale)=landsat_url($lati,$long,$scale); } + elsif ( $mapserver eq 'googlemap') + { + ($url,$mapscale)=googlemap_url($lati,$long,$scale); + } else { print "Unknown map sever :", $mapserver, "\n"; @@ -866,6 +889,53 @@ } + +sub googlemap_url($$$){ + my $lati = shift; + my $long = shift; + my $scale = shift; + + # get altimeter setting for given scale + my $mapscale = $scale; + my $zoom = undef; + for my $s ( sort keys %{$Scale2Zoom->{googlemap}} ) { + next unless $s == $scale; + $zoom = $Scale2Zoom->{googlemap}->{$s}; + $mapscale = $s; + last; + } + + # error if not found + unless ( $zoom ) { + print "Error calculating Zoomlevel for Scale: $scale\n"; + return (undef,undef); + } + + # debug output + if ($debug) { + print "\n"; + print "Using googlemap zoom ", $zoom, " for requested scale ", $scale, ":1 actual scale ", $mapscale, ":1\n"; + print "lat: $lati\n"; + print "lon: $long\n"; + } + + # generate url +# print "\nlat :$lati\nlon: $long\n"; + my $nlati; + my $nlong; + $nlati=sprintf ("%.6f",$lati); + $nlati =~ s/\.//; + $nlong=sprintf ("%.6f",$long); + $nlong =~ s/\.//; +# print "\nnlat :$nlati\nnlon: $nlong\n"; + + my $url = "http://www.google.com/mapprint?c=$nlong,$nlati&r=1280,1024&z=$zoom"; +# print "$url\n"; +# return (undef,undef); + return ($url,$mapscale); +} + + ############################################################################# sub eniro_url($$$){ my $lati = shift; @@ -2214,7 +2284,7 @@ =item B<--mapserver > Mapserver to download from. Default: 'expedia'. -Currently can use: landsat or expedia. +Currently can use: landsat, expedia or googlemap . geoscience, gov_au, incrementp, googlesat and eniro have download stubs, but they are !!!NOT!!!! in the right scale.