$mosaic->pixels_per_km = 40; if (isset($_GET['random'])) { $db = NewADOConnection($GLOBALS['DSN']); $count = $db->cacheGetOne(86400, "SELECT COUNT(*) FROM gridsquare WHERE reference_index=1 AND percent_land = 100"); $offset = rand(0, $count); $str = $db->getOne("SELECT AsText(point_xy) FROM gridsquare WHERE reference_index=1 AND percent_land = 100 AND gridsquare_id > {$offset}"); //limit 1 is added automaticallu preg_match('/\\((\\d+) (\\d+)\\)/', $str, $m); if ($str && $m[1]) { $mapw = $mosaic->image_w / $mosaic->pixels_per_km / 2; $mosaic->setOrigin($m[1] - $mapw, $m[2] - $mapw); } $token = $mosaic->getToken(); $cacheid = 'mapper|' . $token; } elseif (isset($_GET['t'])) { $mosaic->setToken($_GET['t']); $token = $mosaic->getToken(); $cacheid = 'mapper|' . $token; } elseif (isset($_GET['lat'])) { require_once 'geograph/conversions.class.php'; $conv = new Conversions(); list($x, $y) = $conv->national_to_internal($_GET['lon'], $_GET['lat'], 1); if (isset($_GET['zoom'])) { switch ($_GET['zoom']) { case 0: $mosaic->pixels_per_km = 4; break; case 1: $mosaic->pixels_per_km = 40; break; //there isnt a direct equiv
$ri = $second['reference_index']; $letterlength = $CONF['gridpreflen'][$ri]; $smarty->assign('ofe', $letterlength + 1); $smarty->assign('ofn', $letterlength + 3); //assign all the other useful stuff $gr = $map->getGridRef(-1, -1); $smarty->assign('gridref', $gr); if ($map->pixels_per_km == 4) { $starte = substr($gr, $letterlength, 2); $starte = intval($starte) - 50; if ($starte < 0) { $starte += 100; } $startn = substr($gr, $letterlength + 2, 2); $startn = intval($startn) + 50; if ($startn > 100) { $startn -= 100; } $smarty->assign('starte', $starte); $smarty->assign('startn', $startn - 1); } else { $mosaic = new GeographMapMosaic(); $mosaic->setToken($_GET['t'], true); $smarty->assign('mosaic_token', $mosaic->getToken()); $smarty->assign('token_north', $map->getPanToken(0, 1)); $smarty->assign('token_south', $map->getPanToken(0, -1)); $smarty->assign('token_west', $map->getPanToken(-1, 0)); $smarty->assign('token_east', $map->getPanToken(1, 0)); } } $smarty->display($template, $cacheid);
*/ require_once 'geograph/global.inc.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimage.class.php'; require_once 'geograph/map.class.php'; require_once 'geograph/mapmosaic.class.php'; init_session(); $template = 'maplarge.tpl'; $smarty = new GeographPage(); $smarty->caching = 2; // lifetime is per cache //initialise mosaic $mosaic = new GeographMapMosaic(); $overview = new GeographMapMosaic('overview'); if (isset($_GET['o'])) { $overview->setToken($_GET['o']); } if (isset($_GET['t'])) { $ok = $mosaic->setToken($_GET['t']); if (!$ok) { die("Invalid Token"); } } else { die("Missing Token"); } if ($mosaic->pixels_per_km == 80) { $smarty->cache_lifetime = 3600 * 24 * 7; //7 day cache } elseif ($mosaic->mosaic_factor == 4) { } else { die("Invalid Parameter");