if (strlen($entry['view_direction']) && $entry['view_direction'] != -1) { $placemark->addViewDirection($entry['view_direction']); } $Region = $placemark->addChild('Region'); $Region->setPoint($point, 0.01); $delta = $entry['gridimage_id'] % 30; $Region->setLod(1200 + $delta * $delta, -1); $Region->setFadeExtent(100, 0); $folder->addChild($placemark); } else { $x = $entry['x']; $y = $entry['y']; list($south, $west) = $conv->internal_to_wgs84($x, $y, $ri); list($north, $east) = $conv->internal_to_wgs84($x + 1, $y + 1, $ri); $networklink = new kmlNetworkLink(null, $entry['grid_reference']); $file = getKmlFilepath($kml->extension, 6, $square, $entry['grid_reference']); $UrlTag = $networklink->useUrl("http://" . $CONF['KML_HOST'] . $file); $html .= getHtmlLink($file, $entry['grid_reference']); if (!isset($_GET['debug'])) { if (isset($_GET['newonly'])) { $db->Execute("insert ignore into kmlcache set `url` = 'square.php?gr={$entry['grid_reference']}',filename='{$file}',`level` = 6,`rendered` = 0"); } else { $db->Execute("replace into kmlcache set `url` = 'square.php?gr={$entry['grid_reference']}',filename='{$file}',`level` = 6,`rendered` = 0"); } } $UrlTag->setItem('viewRefreshMode', 'onRegion'); $links->addChild($networklink); $Region2 = $networklink->addChild('Region'); $Region2->setBoundary($north, $south, $east, $west); $Region2->setLod(450, -1); $Region2->setFadeExtent(100, 0);
$Region->setPoint($point, 0.01); $delta = $entry['gridimage_id'] % 30; $Region->setLod(50 + $delta, 1300 + $delta * $delta); $Region->setFadeExtent(10, 100); $folder->addChild($placemark); } $letterlength = $CONF['gridpreflen'][$prefix['reference_index']]; $sql_column = "concat(substring(grid_reference,1,{$letterlength}+1),substring(grid_reference,{$letterlength}+3,1))"; $most = $db->GetAll("select \r\ngrid_reference,x,y,\r\n{$sql_column} as hunk_square,\r\nsum(imagecount) as images\r\nfrom gridsquare \r\nwhere {$sql_where}\r\ngroup by hunk_square \r\nhaving images > 0 \r\norder by hunk_square"); foreach ($most as $id => $entry) { $x = intval(($entry['x'] - $prefix['origin_x']) / 10) * 10 + $prefix['origin_x']; $y = intval(($entry['y'] - $prefix['origin_y']) / 10) * 10 + $prefix['origin_y']; list($south, $west) = $conv->internal_to_wgs84($x, $y, $ri); list($north, $east) = $conv->internal_to_wgs84($x + 10, $y + 10, $ri); $networklink = new kmlNetworkLink(null, $entry['hunk_square']); $file = getKmlFilepath($kml->extension, 4, $square, $entry['hunk_square']); $UrlTag = $networklink->useUrl("http://" . $CONF['KML_HOST'] . $file); $html .= getHtmlLink($file, $entry['hunk_square'], 'in Hectad', " (at least {$entry['images']} images)"); if (!isset($_GET['debug'])) { if (isset($_GET['newonly'])) { $db->Execute("insert ignore into kmlcache set `url` = 'hectad.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 4,`rendered` = 0"); } else { $db->Execute("replace into kmlcache set `url` = 'hectad.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 4,`rendered` = 0"); } } $UrlTag->setItem('viewRefreshMode', 'onRegion'); $links->addChild($networklink); $Region2 = $networklink->addChild('Region'); $Region2->setBoundary($north, $south, $east, $west); $Region2->setLod(450, -1); $Region2->setFadeExtent(100, 0);
function kmlPageFooter(&$kml, &$square, $gr, $self, $level, $html = '', $list = '') { global $db, $CONF; if (isset($_GET['debug'])) { print "<a href=?download>Open in Google Earth</a><br/>"; print "<textarea rows=35 style=width:100%>"; print $kml->returnKML(); print "</textarea>"; } elseif (isset($_GET['download'])) { $kml->outputKML(); exit; } else { $file = getKmlFilepath($kml->extension, $level, $square, $gr); $db->Execute("replace into kmlcache set `url` = '{$self}?gr={$gr}',filename='{$file}',`level` = {$level},`rendered` = 1"); $base = $_SERVER['DOCUMENT_ROOT']; $kml->outputFile('kmz', false, $base . $file); if ($html) { $file = str_replace("kml", 'sitemap', $file); $file = str_replace("kmz", 'html', $file); if (!empty($list)) { $s = "Photos in " . $list . " :: Geograph British Isles"; } elseif (isset($square->grid_reference)) { $s = "Photos in {$square->grid_reference} :: Geograph British Isles"; } elseif (!empty($gr)) { $s = "Photos near " . $gr . " :: Geograph British Isles"; } else { $s = "Photos in " . $CONF['references_all'][0]; } $file1 = getKmlFilepath($kml->extension, $level - 1, $square, $gr); $file1 = str_replace("kml", 'sitemap', $file1); $file1 = str_replace("kmz", 'html', $file1); $html = "<html><head><title>{$s}</title></head>\n" . "<body>" . "<h3>Geograph British Isles</h3>" . "<p><a href=\"/\">Homepage</a> | <a href=\"/sitemap/\">Sitemap</a> | <a href=\"{$file1}\">Up one level</a> | {$s}</p>" . "<ul>\n{$html}</ul>" . "</body></html>"; file_put_contents($base . $file, $html); } } }