} $letterlength = $CONF['gridpreflen'][$prefix['reference_index']]; $sql_column = "concat(\r\nsubstring(grid_reference,1,{$letterlength}),\r\nLPAD(substring(grid_reference,{$letterlength}+1,2) div 5 * 5,2,'0'),\r\nLPAD(substring(grid_reference,{$letterlength}+3,2) div 5 * 5,2,'0')\r\n)"; $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, 5, $square, $entry['hunk_square']); $UrlTag = $networklink->useUrl("http://" . $CONF['KML_HOST'] . $file); $html .= getHtmlLink($file, $entry['hunk_square'], 'in subhectad'); if (!isset($_GET['debug'])) { if (isset($_GET['newonly'])) { $db->Execute("insert ignore into kmlcache set `url` = 'mosaic.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 5,`rendered` = 0"); } else { $db->Execute("replace into kmlcache set `url` = 'mosaic.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 5,`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); } $folder->addChild($links); $grs = $square->gridsquare . floor($square->eastings / 10) . floor($square->northings / 10); kmlPageFooter($kml, $square, $gr, 'hectad.php', 4, $html, $grs);
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); } $folder->addChild($links); $grs = array(); $grs[] = $square->gridsquare . floor($square->eastings / 10) . floor($square->northings / 10); $grs[] = $square->gridsquare . (floor($square->eastings / 10) + 1) . floor($square->northings / 10); $grs[] = $square->gridsquare . (floor($square->eastings / 10) + 1) . (floor($square->northings / 10) + 1); $grs[] = $square->gridsquare . floor($square->eastings / 10) . (floor($square->northings / 10) + 1); kmlPageFooter($kml, $square, $gr, 'tile.php', 3, $html, implode(',', $grs));
} else { list($wgs84_lat, $wgs84_long) = $conv->internal_to_wgs84($square->x, $square->y, $square->reference_index); } $point = new kmlPoint($wgs84_lat, $wgs84_long); $placemark = new kmlPlacemark_Photo($entry['gridimage_id'], $square->grid_reference . ' :: ' . $title, $point); $placemark->useHoverStyle(); $image = new GridImage(); $image->fastInit($entry); $placemark->useCredit($image->realname, "http://{$_SERVER['HTTP_HOST']}/photo/" . $image->gridimage_id); $html .= getHtmlLinkP($placemark->link, $square->grid_reference . ' :: ' . $title . ' by ' . $image->realname); $linkTag = "<a href=\"" . $placemark->link . "\">"; $details = $image->getThumbnail(120, 120, 2); $thumb = $details['server'] . $details['url']; $thumbTag = $details['html']; $description = $linkTag . $thumbTag . "</a><br/>" . GeographLinks($image->comment) . " (" . $linkTag . "view full size</a>)" . "<br/><br/> © Copyright <a title=\"view user profile\" href=\"http://" . $_SERVER['HTTP_HOST'] . $image->profile_link . "\">" . $image->realname . "</a> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a><br/><br/>"; $placemark->setItemCDATA('description', $description); //yes that is uppercase S! $placemark->setItemCDATA('Snippet', strip_tags($description)); $placemark->useImageAsIcon($thumb); 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); } kmlPageFooter($kml, $square, $gr, 'centisquare.php', 7, $html);
$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); } } $folder->addChild($links); kmlPageFooter($kml, $square, $gr, 'mosaic.php', 5, $html);
foreach ($photos as $id => $entry) { $point = new kmlPoint($entry['wgs84_lat'], $entry['wgs84_long']); $title = combineTexts($entry['title'], $entry['title2']); $placemark = new kmlPlacemark_Photo($entry['gridimage_id'], $entry['grid_reference'] . ' :: ' . $title, $point); $placemark->useHoverStyle(); $image = new GridImage(); $image->fastInit($entry); $placemark->useCredit($image->realname, "http://{$_SERVER['HTTP_HOST']}/photo/" . $image->gridimage_id); $html .= getHtmlLinkP($placemark->link, $entry['grid_reference'] . ' :: ' . $title . ' by ' . $image->realname); $linkTag = "<a href=\"" . $placemark->link . "\">"; $details = $image->getThumbnail(120, 120, 2); $thumb = $details['server'] . $details['url']; $thumbTag = $details['html']; $description = $linkTag . $thumbTag . "</a><br/>" . GeographLinks($image->comment) . " (" . $linkTag . "view full size</a>)" . "<br/><br/> © Copyright <a title=\"view user profile\" href=\"http://" . $_SERVER['HTTP_HOST'] . $image->profile_link . "\">" . $image->realname . "</a> and licensed for reuse under this <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/2.0/\">Creative Commons Licence</a><br/><br/>"; $placemark->setItemCDATA('description', $description); //yes that is uppercase S! $placemark->setItemCDATA('Snippet', strip_tags($description)); $placemark->useImageAsIcon($thumb); if (isset($directions[$image->gridimage_id])) { $placemark->addViewDirection($directions[$image->gridimage_id]); } $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); } } kmlPageFooter($kml, $square, $gr, 'square.php', 6, $html);
$x = intval(($entry['x'] - $origin['origin_x']) / 100) * 100 + $origin['origin_x']; $y = intval(($entry['y'] - $origin['origin_y']) / 100) * 100 + $origin['origin_y']; list($south, $west) = $conv->internal_to_wgs84($x, $y, $ri); list($north, $east) = $conv->internal_to_wgs84($x + 100, $y + 100, $ri); $Region = $placemark->addChild('Region'); $Region->setBoundary($north, $south, $east, $west); $Region->setLod(10, 600); $Region->setFadeExtent(50, 200); $networklink = new kmlNetworkLink(null, $entry['hunk_square']); $file = getKmlFilepath($kml->extension, 2, $square, $entry['hunk_square']); $UrlTag = $networklink->useUrl("http://" . $CONF['KML_HOST'] . $file); $html .= getHtmlLink($file, $entry['hunk_square'], 'in Myriad', " (" . $names[$entry['hunk_square']] . ")"); if (!isset($_GET['debug'])) { if (isset($_GET['newonly'])) { $db->Execute("insert ignore into kmlcache set `url` = 'myriad.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 2,`rendered` = 0"); } else { $db->Execute("replace into kmlcache set `url` = 'myriad.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 2,`rendered` = 0"); } } $UrlTag->setItem('viewRefreshMode', 'onRegion'); $links->addChild($networklink); $Region2 = clone $Region; $Region2->setLod(450, -1); $Region2->setFadeExtent(100, 0); $networklink->addChild($Region2); } } $folder->addChild($circles); $folder->addChild($links); kmlPageFooter($kml, $square, $gr, 'geograph.php', 1, $html);
$placemark->useHoverStyle('c2'); $folder->addChild($placemark); $x = intval(($entry['x'] - $prefix['origin_x']) / 20) * 20 + $prefix['origin_x']; $y = intval(($entry['y'] - $prefix['origin_y']) / 20) * 20 + $prefix['origin_y']; list($south, $west) = $conv->internal_to_wgs84($x, $y, $ri); list($north, $east) = $conv->internal_to_wgs84($x + 20, $y + 20, $ri); $Region = $placemark->addChild('Region'); $Region->setBoundary($north, $south, $east, $west); $Region->setLod(100, 650); $Region->setFadeExtent(50, 150); $networklink = new kmlNetworkLink(null, $entry['hunk_square']); $file = getKmlFilepath($kml->extension, 3, $square, $entry['hunk_square']); $UrlTag = $networklink->useUrl("http://" . $CONF['KML_HOST'] . $file); $html .= getHtmlLink($file, $entry['hunk_square'], 'in tile', " (at least {$entry['images']} images)"); if (!isset($_GET['debug'])) { if (isset($_GET['newonly'])) { $db->Execute("insert ignore into kmlcache set `url` = 'tile.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 3,`rendered` = 0"); } else { $db->Execute("replace into kmlcache set `url` = 'tile.php?gr={$entry['hunk_square']}',filename='{$file}',`level` = 3,`rendered` = 0"); } } $UrlTag->setItem('viewRefreshMode', 'onRegion'); $links->addChild($networklink); $Region2 = clone $Region; $Region2->setLod(450, -1); $Region2->setFadeExtent(10, 0); $networklink->addChild($Region2); } $folder->addChild($links); kmlPageFooter($kml, $square, $gr, 'myriad.php', 2, $html);