$box->MINX = 0 - $lon - $res; $box->MAXX = $box->MINX + $res; $box->MINY = 0 - $lat - $res; $box->MAXY = 0 - $lat; break; case '7': // NW $box->MINX = 0 - $lon - $res; $box->MAXX = $box->MINX + $res; $box->MINY = $lat; $box->MAXY = $box->MINY + $res; break; default: break; } $box->wkt = 'POLYGON((' . $box->MINY . ' ' . $box->MAXX . ',' . $box->MINY . ' ' . $box->MINX . ',' . $box->MAXY . ' ' . $box->MINX . ',' . $box->MAXY . ' ' . $box->MAXX . ',' . $box->MINY . ' ' . $box->MAXX . '))'; } if (0) { // how to display in Google? // bounds of enclosing 10 degree square $lat = 42.85; $lon = 147.28; //$lat = -51; //$lon = 71; $sb = lat_lon_2_csquare($lat, $lon); echo "{$sb}\n"; $box = new stdclass(); unpack_csquare($sb, $box); echo "\n"; print_r($box); }
</div> </div> </body> </html> <?php } else { $state = 404; // not found $box = new stdclass(); $resolution = 10; if (preg_match('/^(?<ten>[1357][0-9]{3})(:(?<one>[0-9]{3}))?$/', $csquare, $matches)) { if (isset($matches['one'])) { $resolution = 1; } unpack_csquare($csquare, $box, $resolution); $state = 200; } switch ($state) { case 400: ob_start(); header('HTTP/1.0 400'); header('Status: 400'); $_SERVER['REDIRECT_STATUS'] = 400; break; case 200: switch ($format) { case 'rdf': case 'xml': $feed = new DomDocument('1.0'); $rdf = $feed->createElement('rdf:RDF');