if ($grid_ok) { //geotag the page 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); //lets add an rastermap too $rastermap = new RasterMap($square, false, $square->natspecified, true); $rastermap->addLatLong($lat, $long); $smarty->assign_by_ref('gridref', $gridref); if (!empty($photographer_gridref)) { $psquare = new GridSquare(); $pgrid_given = true; $pgrid_ok = $psquare->setByFullGridRef($photographer_gridref, true, false, true); if (!empty($psquare->nateastings)) { $rastermap->addViewpoint($psquare->reference_index, $psquare->nateastings, $psquare->natnorthings, $psquare->natgrlen); $smarty->assign_by_ref('photographer_gridref', $photographer_gridref); } } if (isset($view_direction) && strlen($view_direction) && $view_direction != -1) { $rastermap->addViewDirection(intval($view_direction)); $smarty->assign_by_ref('view_direction', $view_direction); } $smarty->assign_by_ref('rastermap', $rastermap); $gaz = new Gazetteer(); $places = $gaz->findListByNational($square->reference_index, $square->nateastings, $square->natnorthings, $square->reference_index == 1 ? 2000 : 5000); $smarty->assign_by_ref('places', $places); } $smarty->display($template, $cacheid);
/** * Error because trying to access with POST HTTP request * * @expectedException Exception * @expectedExceptionCode 404 */ public function testGazetteer_run_error_1() { $this->initContext(); $this->context->method = 'POST'; $segments = array(); $gazetteerModule = new Gazetteer($this->context, $this->admin); $gazetteerModule->run($segments); }
public function all($world = null) { !$world ? $world = "world" : ($world = $world); echo \Gazetteer::hello($world) . "!<br>Successfully processed @ " . \Carbon\Carbon::now(); echo "<br/><br/>"; echo "<h3>Gazetteer::countries() <small> ********** returns a collection of available countries</small></h3>"; echo \Gazetteer::countries(); echo "<br/><br/>"; echo "<h3>Gazetteer::countries(\$country_code) <small> ********** returns an instance of the requested country (searched by country code)</small></h3>"; echo \Gazetteer::countries("AU"); echo "<br/><br/>"; echo "<h3>Gazetteer::countries(\$country_name) <small> ********** returns an instance of the requested country (searched by country name)</small></h3>"; echo \Gazetteer::countries("Maldives"); echo "<br/><br/>"; echo "<h3>Gazetteer::states(\$country_code) <small> ********** returns a collection of states for a given country (searched by country code)</small></h3>"; echo \Gazetteer::states("AU"); echo "<br/><br/>"; echo "<h3>Gazetteer::states(\$country_name) <small> ********** returns a collection of states for a given country (searched by country name)</small></h3>"; echo \Gazetteer::states("Maldives"); echo "<br/><br/>"; echo "<h3>Gazetteer::cities(\$country,\$states) <small> ********** returns a collection of states for a given country (searched by country name)</small></h3>"; echo \Gazetteer::cities("AU", "QLD"); echo "<br/><br/>"; echo "<h3>Gazetteer::postcode(\$postcode) <small> ********** returns a collection of suburbs for a given postcode (searched by postcode)</small></h3>"; echo \Gazetteer::postcode("4067"); }
function setByPlacename($placename) { global $CONF; $gaz = new Gazetteer(); $this->ismore = strpos($placename, '?') !== FALSE; $places = $gaz->findPlacename($placename); if (count($places) == 1) { $this->x = intval($places[0]['e'] / 1000) + $CONF['origins'][$places[0]['reference_index']][0]; $this->y = intval($places[0]['n'] / 1000) + $CONF['origins'][$places[0]['reference_index']][1]; $this->placename = $places[0]['full_name'] . ($places[0]['adm1_name'] ? ", {$places[0]['adm1_name']}" : ''); $this->searchq = $placename; $this->full_name = $places[0]['full_name']; $this->reference_index = $places[0]['reference_index']; $this->_matches = $places; } elseif (count($places)) { $this->matches = $places; $this->is_multiple = true; $this->searchq = $placename; } }
function findNearestPlace($radius, $gazetteer = '') { #require_once('geograph/gazetteer.class.php'); if (!isset($this->nateastings)) { $this->getNatEastings(); } $gaz = new Gazetteer(); return $gaz->findBySquare($this, $radius, null, $gazetteer); }
/** * Saves update tables based on gridimage */ function updatePlaceNameId($gridsquare = null) { global $CONF; $db =& $this->_getDB(); if (!$gridsquare) { $gridsquare = $this->grid_square; } if (!isset($gridsquare->nateastings)) { $gridsquare->getNatEastings(); } $gaz = new Gazetteer(); //to optimise the query, we scan a square centred on the //the required point $radius = 30000; $places['pid'] = $gaz->findBySquare($gridsquare, $radius, array('C', 'T')); $db->Execute("update gridimage set placename_id = '{$places['pid']}',upd_timestamp = '{$this->upd_timestamp}' where gridimage_id = {$this->gridimage_id}"); }