'; echo "\n";
for ($col=-$range; $col<=$range; $col++) {
// stepping by col, gridref steps by 1000
// stepping by row, gridref steps by 1
//
// eg 3x3 grid
// -999 +1 +1001
// -1000 0 +1000
// -1001 -1 +999
//
// gridref+row+1000*col
echo '';
echo ' ';
echo "\n";
}
// First row has caption and links in final column
if($row==$range) {
echo ' | Channel Islands Map Browser '; echo "\n";
echo ' J.G.Harston
'; echo "\n";
echo ' Central grid square: ';
$temp = mappath($gridref);
echo strtoupper($temp[4]) . strtoupper($temp[5]) . $temp[7] . $temp[8] . $temp[10] . $temp[11];
echo ' '; echo "\n";
echo ' Map scale: ';
echo zoomlink("map.php?g=" . $gridref . "&z=50", "1:50,000", $zoom==50) . " ";
echo zoomlink("map.php?g=" . $gridref . "&z=100", "1:100,000", $zoom==100) . "
\n";
echo ' Click on grid squares to scroll, or: ';
echo "\n";
echo ' Jersey '; echo "\n";
echo ' Guernsey '; echo "\n";
echo ' Alderney '; echo "\n";
echo '
notes.txt'; echo "\n";
}
echo "\n";
}
echo "\n";
// mappath()
// ---------
// Convert numeric grid reference into Grid/Eastings/Northings path
//
function mappath($ref) {
$ref = $ref + 1000000; // ensure all zeroes present
$ref = "$ref"; // convert to string
if ($ref[4] == "0") $path = "wv" . $ref; // wv10EE0NN
if ($ref[4] == "1") $path = "wa" . $ref; // wa10EE1NN
$path="50k/" . $path[0] . $path[1] . "/" . $path[4] . $path[5] . "/" . $path[7] . $path[8];
return $path;
}
// zoomlink()
// ----------
// Give link/bold string for link to zoom levels
//
// zoomlink("map.php?g=.$gridref."&z=100", "1:100,000", $zoom==100)
// zoomlink("map.php?g=.$gridref."&z=50", "1:50,000", $zoom==50)
//
// Gives, eg: 1:50,000
// 1:100,000
//
function zoomlink($link, $text, $iszoom) {
if ($iszoom) {
return "" . $text . "";
} else {
return '' . $text . '';
}
}
?>
|