I created a script based on
http://dev-thebrain.blogspot.com/2008/11/useful-formulas.html
However for some reason it starts off the calculation at the wrong
latitude. For tile 0,0 the latitude_max should be 90, but instead it
is 14.17. By contrast the longitude is fine.
lat1= -29.307494906848
lat2= 14.177038956973
lon1-180
lon2= -135
$iZoom=3;
$iTiles_long= pow(2, ($iZoom));
$iTiles_lat=pow(2, ($iZoom));
//Starts at tile 0,0, which has an upperleft corner of -180,90
for ($iI=0; $iI<$iTiles_long; $iI++)
{
for ($iJ=0; $iJ<$iTiles_lat; $iJ++)
{
$sImgname="heat_".$iZoom."_".($iI)."_".($iJ).".png";
$im = @imagecreatetruecolor(256, 256);
//First for each tile
$iTile_upperleft_x=256*$iI;
$iTile_upperleft_y=256*$iJ;
$iTile_lowerright_x=256*($iI+1);
$iTile_lowerright_y=256*($iJ+1);
$iDenom=256*pow(2,$iZoom);
$iEfactor_min=pow(exp(1), (0.5-(($iTile_lowerright_y)/
($iDenom))*4*3.14159));
$iEfactor_max=pow(exp(1), (0.5-(($iTile_upperleft_y)/
($iDenom))*4*3.14159));
$fTile_lat_min=asin (($iEfactor_min-1)/($iEfactor_min+1)) *
(180/3.14159);
$fTile_lat_max=asin (($iEfactor_max-1)/($iEfactor_max+1)) *
(180/3.14159);
echo "<br>ftile $iI, $iJ: $fTile_lat_min $fTile_lat_max
$fTile_long_min $fTile_long_max";
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.