Ejemplo n.º 1
0
 public function testUTM()
 {
     $coord = new coordinate(51.52775, -120.8972);
     $utm = $coord->getUTM();
     $this->assertEquals('10', $utm['zone']);
     $this->assertEquals('U', $utm['letter']);
     $this->assertEquals('N 5710611', $utm['north']);
     $this->assertEquals('E 645865', $utm['east']);
     $coord = new coordinate(-8.81687, 13.24057);
     $utm = $coord->getUTM();
     $this->assertEquals('33', $utm['zone']);
     $this->assertEquals('L', $utm['letter']);
     $this->assertEquals('N 9024939', $utm['north']);
     $this->assertEquals('E 306489', $utm['east']);
     $coord = new coordinate(52.67578, 6.773);
     $utm = $coord->getUTM();
     $this->assertEquals('32', $utm['zone']);
     $this->assertEquals('U', $utm['letter']);
     $this->assertEquals('N 5838532', $utm['north']);
     $this->assertEquals('E 349438', $utm['east']);
     $coord = new coordinate(60.63367, 4.81313);
     $utm = $coord->getUTM();
     $this->assertEquals('32', $utm['zone']);
     $this->assertEquals('V', $utm['letter']);
     $this->assertEquals('N 6729280', $utm['north']);
     $this->assertEquals('E 271052', $utm['east']);
     $coord = new coordinate(58.682079, 5.793595);
     $utm = $coord->getUTM();
     $this->assertEquals('32', $utm['zone']);
     $this->assertEquals('V', $utm['letter']);
     $this->assertEquals('N 6509097', $utm['north']);
     $this->assertEquals('E 314134', $utm['east']);
 }
Ejemplo n.º 2
0
 /**
  * @group unit-tests
  * @covers       \coordinate::getUTM()
  * @dataProvider utmProvider
  *
  * @return void
  */
 public function testUTM($lat, $lon, $zone, $letter, $north, $east)
 {
     $coord = new \coordinate($lat, $lon);
     $utm = $coord->getUTM();
     self::assertEquals($zone, $utm['zone']);
     self::assertEquals($letter, $utm['letter']);
     self::assertEquals($north, $utm['north']);
     self::assertEquals($east, $utm['east']);
 }
Ejemplo n.º 3
0
$tpl->popup = true;
$lat_float = 0;
if (isset($_REQUEST['lat'])) {
    $lat_float += $_REQUEST['lat'];
}
$lon_float = 0;
if (isset($_REQUEST['lon'])) {
    $lon_float += $_REQUEST['lon'];
}
$cache_country = isset($_REQUEST['country']) ? $_REQUEST['country'] : false;
$cache_desclang = isset($_REQUEST['desclang']) ? $_REQUEST['desclang'] : false;
$coord = new coordinate($lat_float, $lon_float);
$tpl->assign('coordDeg', $coord->getDecimal());
$tpl->assign('coordDegMin', $coord->getDecimalMinutes());
$tpl->assign('coordDegMinSec', $coord->getDecimalMinutesSeconds());
$tpl->assign('coordUTM', $coord->getUTM());
$tpl->assign('coordGK', $coord->getGK());
$tpl->assign('coordRD', $coord->getRD());
$tpl->assign('showRD', $coord->nLat >= 45 && $coord->nLat <= 57 && $coord->nLon >= 0 && $coord->nLon <= 15);
$tpl->assign('coordQTH', $coord->getQTH());
$tpl->assign('coordSwissGrid', $coord->getSwissGrid());
// build priority list of W3W languages to display
// 1. current page locale
$w3w_langs = array();
if ($opt['locale'][$opt['template']['locale']]['what3words']) {
    $w3w_langs[] = $opt['template']['locale'];
}
// 2. language of the cache description
if ($cache_desclang && !in_array($cache_desclang, $w3w_langs)) {
    $w3w_langs[] = $cache_desclang;
}