Exemplo n.º 1
0
 //from lat/long
 if ($_GET['datum'] == 'osgb36') {
     $en = $conv->wgs84_to_osgb36($_GET['lat'], $_GET['long']);
 } else {
     if ($_GET['datum'] == 'irish') {
         list($usec, $sec) = explode(' ', microtime());
         $querytime_before = (double) $usec + (double) $sec;
         for ($q = 0; $q < 200; $q++) {
             $en = $conv->wgs84_to_irish($_GET['lat'], $_GET['long'], $_GET['usehermert']);
         }
         $en = $conv->wgs84_to_irish($_GET['lat'], $_GET['long'], $_GET['usehermert']);
         list($usec, $sec) = explode(' ', microtime());
         $querytime_after = (double) $usec + (double) $sec;
         $smarty->assign('querytime', "200 conversions took " . number_format($querytime_after - $querytime_before, 4) . " Seconds");
     } else {
         list($e, $n, $reference_index) = $conv->wgs84_to_national($_GET['lat'], $_GET['long'], $_GET['usehermert']);
         if ($reference_index == 1) {
             $en = array($e, $n);
             $_GET['datum'] = "osgb36";
         } else {
             if ($reference_index == 2) {
                 $en = array($e, $n);
                 $_GET['datum'] = "irish";
             }
         }
     }
 }
 if (count($en)) {
     $smarty->assign('e', $en[0]);
     $smarty->assign('n', $en[1]);
     $smarty->assign('lat', $_GET['lat']);