示例#1
0
function maxLongFromMaidenhead($maidenhead) {
	$figures = strlen($maidenhead);
	if ($figures == 2) {
		return minLongFromMaidenhead($maidenhead) + 20;
	} elseif ($figures == 4) {
		return minLongFromMaidenhead($maidenhead) + 2;
	} elseif ($figures == 6) {
		return minLongFromMaidenhead($maidenhead) + (1/12);
	} else {
		die("Invalid number of figures: " . $figures);
	}
}
示例#2
0
<?php
require_once("geographics.inc.php");
$testVector = "AB12CD";
echo ($testVector . " -> " . minLatFromMaidenhead($testVector) . "; " . minLongFromMaidenhead($testVector) . " -> " . maxLatFromMaidenhead($testVector) . "; " . maxLongFromMaidenhead($testVector) . "<br />\n");

$testVector = "JO01";
echo ($testVector . " -> " . minLatFromMaidenhead($testVector) . "; " . minLongFromMaidenhead($testVector) . " -> " . maxLatFromMaidenhead($testVector) . "; " . maxLongFromMaidenhead($testVector) . "\n");

$testVector = "JO00";
echo ($testVector . " -> " . minLatFromMaidenhead($testVector) . "; " . minLongFromMaidenhead($testVector) . " -> " . maxLatFromMaidenhead($testVector) . "; " . maxLongFromMaidenhead($testVector) . "\n");

$fields = array("JO", "JN", "IO");
$bigSquares = array();
$k = 0;
for ($i = 0; $i < 100; $i++) {
	for ($j = 0; $j < count($fields); $j++) {
		$bigSquares[$k++] = $fields[$j] . str_pad($i, 2, "0");
	}
}
echo ("<pre>" . print_r($bigSquares) . "</pre>");
?>
<?php echo("Hello");?>
示例#3
0
						minLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10," .
						minLongFromMaidenhead($bigSquare) . "," . maxLatFromMaidenhead($bigSquare) . ",10," .
						maxLongFromMaidenhead($bigSquare) . "," . maxLatFromMaidenhead($bigSquare) . ",10," .
						maxLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10," .
						minLongFromMaidenhead($bigSquare) . "," . minLatFromMaidenhead($bigSquare) . ",10");
				?></coordinates>
			  </LinearRing>
			</outerBoundaryIs>
		  </Polygon>
	</Placemark>
<?php
}
echo "
  </Folder>
  <Folder>
    <name>Contacts</name>
";
$cCnt = 0; // Colour count
foreach (getContacts() as $callsign => $locator) {
	?><Placemark>
		<name><?php echo ($callsign); ?></name>
                <styleUrl>#m_<?php if($cCnt < 5) { echo "grn"; } else { echo "ylw"; } $cCnt ++?>-pushpin</styleUrl>
		<Point><coordinates><?php echo (minLongFromMaidenhead(strtolower($locator)) . "," . minLatFromMaidenhead(strtolower($locator))); ?></coordinates></Point>
	</Placemark><?php
}
echo "
  </Folder>";
?>
</Document> 
</kml>