예제 #1
0
function GetSurroundingGridIDs($sectional, $gridNum, $quadrant = "E", $format = "dmm")
{
    $CenterGridCoords = grid2lonlat($sectional, $gridNum, $quadrant, "raw");
    $CenterGrid = array("sectional" => $sectional, "grid" => $gridNum, "quadrant" => $quadrant);
    $NorthGridLat = $CenterGridCoords['NE']['lat'] + 0.05;
    $NorthGridLon = ($CenterGridCoords['NE']['lon'] + $CenterGridCoords['NW']['lon']) / 2;
    $NorthGrid = lonlat2grid($NorthGridLon, $NorthGridLat);
    $SouthGridLat = $CenterGridCoords['SE']['lat'] - 0.05;
    $SouthGridLon = $NorthGridLon;
    $SouthGrid = lonlat2grid($SouthGridLon, $SouthGridLat);
    $EastGridLat = ($CenterGridCoords['NE']['lat'] + $CenterGridCoords['SE']['lat']) / 2;
    $EastGridLon = $CenterGridCoords['NE']['lon'] + 0.05;
    $EastGrid = lonlat2grid($EastGridLon, $EastGridLat);
    $WestGridLat = $EastGridLat;
    $WestGridLon = $CenterGridCoords['NW']['lon'] - 0.05;
    $WestGrid = lonlat2grid($WestGridLon, $WestGridLat);
    if ($CenterGrid['quadrant'] == "E") {
        $NorthGrid['quadrant'] = "";
        $SouthGrid['quadrant'] = "";
        $EastGrid['quadrant'] = "";
        $WestGrid['quadrant'] = "";
    } else {
        $NorthGrid['quadrant'] = " - " . $NorthGrid['quadrant'];
        $SouthGrid['quadrant'] = " - " . $SouthGrid['quadrant'];
        $EastGrid['quadrant'] = " - " . $EastGrid['quadrant'];
        $WestGrid['quadrant'] = " - " . $WestGrid['quadrant'];
    }
    $SurroundingGrids = array("Center" => $CenterGrid, "North" => $NorthGrid, "South" => $SouthGrid, "East" => $EastGrid, "West" => $WestGrid);
    return $SurroundingGrids;
}
예제 #2
0
    $myquadrant = $_GET['myquadrant'];
}
if (isset($_GET['lon'])) {
    $pointLongitude = $_GET['lon'];
    $lonlatflag = 1;
}
if (isset($_GET['lat'])) {
    $pointLatitude = $_GET['lat'];
}
if ($myquadrant != "E") {
    $quadrantDisplay = "-" . $myquadrant;
}
# Determine the raw lon/lat of the top-left grid corner
$gridLon = $gridLat = $longitude = $latitude = 0;
if ($lonlatflag) {
    $result1 = lonlat2grid($pointLongitude, $pointLatitude);
    $sectional = $result1['sectional'];
    $mygrid = $result1['grid'];
    $myquadrant = $result1['quadrant'];
}
$result = grid2lonlat($sectional, $mygrid, $myquadrant, "raw");
$abbrev = $coordinates[$sectional]['Abbrev'];
$gridLon = $result['NW']['lon'];
$gridLat = $result['NW']['lat'];
$gridLabel = "{$abbrev} - {$mygrid}";
$filenameHeader = "Content-Disposition: attachment; filename=\"" . $abbrev . "_" . $mygrid . "-" . $myquadrant . ".kml\"";
$sectionalName = ucwords(strtolower(preg_replace("/_/", " ", $sectional)));
#echo "Lon: $gridLon    Lat: $gridLat    $abbrev - $mygrid \n";
?>
<!doctype html>
<html lang="en">
예제 #3
0
$output = $onload = "";
$rawLat = $rawLon = 0;
if ($submit == "Go") {
    $output = "<div align=\"center\" class=\"coord\"><b>Not Found</b></div>";
    $onload = "";
    switch ($selectedFormat) {
        case "dmm":
            $rawLat = $latDegDMM + $latMinDMM / 60;
            $rawLon = -($lonDegDMM + $lonMinDMM / 60);
            break;
        case "dms":
            $rawLat = $latDegDMS + $latMinDMS / 60 + $latSecDMS / 3600;
            $rawLon = -($lonDegDMS + $lonMinDMS / 60 + $lonSecDMS / 3600);
            break;
    }
    $result = lonlat2grid($rawLon, $rawLat);
    if (isset($result['quadrant'])) {
        $quadrant = $result['quadrant'];
    } else {
        $quadrant = -1;
    }
    if ($quadrant > -1) {
        $sectional = $result['sectional'];
        $abbrev = $coordinates[$sectional]['Abbrev'];
        $displaySectional = ucwords(strtolower(preg_replace("/_/", " ", $sectional)));
        $grid = $result['grid'];
        $quadrant = $result['quadrant'];
        $output = "<div align=\"center\" class=\"coord\"><b>{$displaySectional} ({$abbrev}) &nbsp; &nbsp; {$grid} - {$quadrant}</b></div>";
        $urlSrc = "id=" . $sectional . "&mygrid=" . $grid . "&myquadrant=" . $quadrant . "&myformat=" . $selectedFormat;
        $onload = "onLoad=\"javascript:parent.setCornerUrl('" . $urlSrc . "');\"";
    }