PHP & CloudMade OpenStreetMap API



<html>
<head>
<title>geo tag ads</title>
</head>
<body>
<?

require 'apikey.php';

function e($s) {
    echo $s . PHP_EOL;
}

function tile($size=64, $h=4, $w=4, $zoom=15, $x=17590, $y=10750) {
    global $url;
    $styles=array(1,2,4,6681);

    for ($row=0;$row<$h;$row++) {
        e("<tr>");
        for ($col=0;$col<$w;$col++) {
            $style=$styles[rand(0,3)];
            $xx=$x+$col;
            $yy=$y+$row;
            e("<td><img src='$url/$style/$size/$zoom/{$xx}/{$yy}.png'/></td>");
        }
        e("</tr>");
    }
}
?>
<h3>cloudmade styled openstreetmap api based map tiles</h3>
<?

$osm="http://openstreetmap.org";
$url="http://tile.cloudmade.com/$apikey";

$s = $_REQUEST['s']>0 ? $_REQUEST['s'] : 256;
if ($s<>64 && $s<>256) $s=64;
$h = $_REQUEST['h']>0 ? $_REQUEST['h'] : 4;
if ($h>16) $h=4;
$w = $_REQUEST['w']>0 ? $_REQUEST['w'] : 4;
if ($w>16) $w=4;
?>
<?=$s?> x <?=$s?> map tiles<br />
<a href="<?=$osm?>">
<table><? tile($s,$h,$w) ?></table>
</a>
</body>
</html>



REFERRERS
OpenStreetMap
PhpApis
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki