require_once 'geograph/conversions.class.php'; $conv = new Conversions(); list($lat, $long) = $conv->gridsquare_to_wgs84($square); $smarty->assign('lat', $lat); $smarty->assign('long', $long); $smarty->assign_by_ref('square', $square); //get a token to show a suroudding geograph map $mosaic = new GeographMapMosaic(); $smarty->assign('map_token', $mosaic->getGridSquareToken($square)); if ($CONF['forums']) { $square->assignDiscussionToSmarty($smarty); } if (!empty($CONF['sphinx_host'])) { //look for images from here... $sphinx = new sphinxwrapper(); if (!isset($viewpoint_count) && ($viewpoint_count = $sphinx->countImagesViewpoint($square->nateastings, $square->natnorthings, $square->reference_index, $square->grid_reference))) { $smarty->assign('viewpoint_count', $viewpoint_count); #$smarty->assign('viewpoint_query', $sphinx->q); } if (!isset($mention_count) && ($mention_count = $sphinx->countQuery("{$square->grid_reference} -grid_reference:{$square->grid_reference}", "_images"))) { $smarty->assign('mention_count', $mention_count); } } if ($square->natspecified && $square->natgrlen >= 6) { $conv = new Conversions(''); list($gr6, $len) = $conv->national_to_gridref($square->getNatEastings(), $square->getNatNorthings(), 6, $square->reference_index, false); $smarty->assign('gridref6', $gr6); } } else { $smarty->assign('errormsg', $square->errormsg); //includes a closest match?
list($latdm, $longdm) = $conv->wgs84_to_friendly($lat, $long); $smarty->assign('latdm', $latdm); $smarty->assign('longdm', $longdm); $smarty->assign('el', $long > 0 ? 'E' : 'W'); $smarty->assign('nl', $lat > 0 ? 'N' : 'S'); $smarty->assign('lat_abs', abs($lat)); $smarty->assign('long_abs', abs($long)); //get a token to show a suroudding geograph map $mosaic = new GeographMapMosaic(); $smarty->assign('map_token', $mosaic->getGridSquareToken($square)); if (!empty($CONF['forums'])) { $square->assignDiscussionToSmarty($smarty); } //look for images from here... $sphinx = new sphinxwrapper(); if ($viewpoint_count = $sphinx->countImagesViewpoint($square->getNatEastings(), $square->getNatNorthings(), $square->reference_index, $square->grid_reference)) { $smarty->assign('viewpoint_count', $viewpoint_count); $smarty->assign('viewpoint_query', $sphinx->q); } if ($square->natspecified && $square->natgrlen >= 6) { $conv = new Conversions(''); list($gr6, $len) = $conv->national_to_gridref($square->getNatEastings(), $square->getNatNorthings(), 6, $square->reference_index, false); $smarty->assign('gridref6', $gr6); } //lets add an overview map too $overview = new GeographMapMosaic('largeoverview'); $overview->setCentre($square->x, $square->y); //does call setAlignedOrigin $smarty->assign('marker', $overview->getSquarePoint($square)); //lets add an rastermap too $rastermap = new RasterMap($square, false, $square->natspecified);