DebugTileServer
If you're writing a custom tile server it's nice to be able to see what parameters are being passed. This little PHP script generates tiles containing debug information about the tile request rather than mapping data.
<?php
// Output a tile containing debug information about the args we were
// called with.
define('SIZE', 200);
define('FONT', 2);
define('VINSET', 4);
define('HINSET', 4);
define('LSPACE', 2);
$width = isset($_GET['WIDTH']) ? $_GET['WIDTH'] : SIZE;
$height = isset($_GET['HEIGHT']) ? $_GET['HEIGHT'] : SIZE;
$img = imagecreatetruecolor($width, $height);
$bg = imagecolorallocate($img, 190, 212, 253);
$fg = imagecolorallocate($img, 0, 0, 0);
$border = imagecolorallocate($img, 128, 128, 128);
// Draw background, border
imagefilledrectangle($img, 0, 0, $width-1, $height-1, $bg);
imagerectangle($img, 0, 0, $width-1, $height-1, $border);
// Draw text
$tw = imagefontwidth(FONT);
$th = imagefontheight(FONT);
$tx = HINSET;
$ty = VINSET;
$cw = 0;
while (list($n, $v) = each($_GET)) {
imagestring($img, FONT, $tx, $ty, "$n = $v", $fg);
$ty += $th + LSPACE;
}
header('Content-type: image/png');
imagepng($img);
?>
submitted by Andy Armstrong
