[go: up one dir, main page]

Menu

[r1]: / omgm / tile.php  Maximize  Restore  History

Download this file

67 lines (50 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
$zoom = $_GET["zoom"];
$tileX = $_GET["x"];
$tileY = $_GET["y"];
header ('Content-type: image/png');
$tileImage = "tilesdir/".$zoom."/x".$tileX."_y".$tileY.".png";
$showTileInfo = false;
if($showTileInfo){
include "gm.php";
}
if( file_exists($tileImage) ) {
$im = imagecreatefrompng($tileImage);
if($showTileInfo) writeTileInfo($im, $zoom, $tileX, $tileY);
imagepng($im);
imagedestroy($im);
}
else {
$im = @imagecreatetruecolor(256, 256);
if($im) {
imagesavealpha($im, true);
$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $trans_colour);
if($showTileInfo) writeTileInfo($im, $zoom, $tileX, $tileY);
imagepng($im);
imagedestroy($im);
}
}
function writeTileInfo($im, $zoom, $tileX, $tileY) {
$value = Google_Tile_Factors( $zoom );
$tile = Google_Tile_Calc( $value, $tileY, $tileX ) ;
$text_color = imagecolorallocate($im, 233, 14, 91);
$strArr = array(
"X=".$tileX . ", Y=".$tileY.", ZOOM=".$zoom,
"latN: ".$tile["LATN"],
"lngW: ".$tile["LNGW"],
"latS: ".$tile["LATS"],
"lngE: ".$tile["LNGE"],
"pixN: ".$tile["PYN"],
"pixW: ".$tile["PXW"],
"pixS: ".$tile["PYS"],
"pixE: ".$tile["PXE"]
);
$y = 5;
foreach($strArr as $str) {
imagestring($im, 2, 5, $y, $str , $text_color);
$y = $y+15;
}
imagerectangle($im, 0, 0, 255, 255, $text_color);
}
?>