require_once 'geograph/map.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
require_once 'geograph/conversions.class.php';
$conv = new Conversions();
$gr = $_GET['gr'];
$square = new GridSquare();
$grid_ok = $square->setByFullGridRef($gr);
$html = '';
$kml = new kmlFile();
$kml->atom = true;
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', "{$gr} :: Geograph SuperLayer");
$links = new kmlPrimative('Folder');
$links->setItem('name', 'Next Level...');
$prefix = $db->GetRow('select * from gridprefix where prefix=' . $db->Quote($square->gridsquare) . ' limit 1');
$left = $prefix['origin_x'] + intval($square->eastings / 20) * 20;
$right = $left + 20 - 1;
$bottom = $prefix['origin_y'] + intval($square->northings / 20) * 20;
$top = $bottom + 20 - 1;
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$photos = $db->GetAll("select \r\ngridimage_id,grid_reference,title,title2,imagecount,view_direction,natgrlen,realname,\r\nwgs84_lat,wgs84_long\r\nfrom gridimage_kml \r\nwhere {$sql_where} and tile = 1\r\norder by null");
foreach ($photos as $id => $entry) {
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
require_once 'geograph/kmlfile2.class.php';
preg_match('/(kh_|GoogleEarth)\\w+\\/\\w+(\\d).(\\d)/', $_SERVER['HTTP_USER_AGENT'], $m);
$kml = new kmlFile();
$kml->filename = "Geograph-Layer.kml";
$i = !empty($_GET['i']) ? intval($_GET['i']) : '';
if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == '-') {
    //Google Maps (Mapplet)
    $NetworkLink = $kml->addChild('NetworkLink');
    $NetworkLink->setItem('name', 'Geograph NetworkLink');
    $NetworkLink->setItemCDATA('description', <<<END_HTML
<table bgcolor="#000066" border="0"><tr bgcolor="#000066"><td bgcolor="#000066">
<a href="http://{$_SERVER['HTTP_HOST']}/"><img src="http://{$_SERVER['HTTP_HOST']}/templates/basic/img/logo.gif" height="74" width="257"/></a>
</td></tr></table>

<p><i>The Geograph British Isles project aims to collect geographically representative photographs and information for every square kilometre of the UK and the Republic of Ireland, and you can be part of it.</i></p>

<p><b>Join us now at: <a href="http://{$_SERVER['HTTP_HOST']}/">{$_SERVER['HTTP_HOST']}</a></b>, and read more about the <a href="http://{$_SERVER['HTTP_HOST']}/kml.php">Google intergration</a>.</p>
END_HTML
require_once 'geograph/map.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
require_once 'geograph/conversions.class.php';
$conv = new Conversions();
$gr = $_GET['gr'];
$square = new GridSquare();
$grid_ok = $square->setByFullGridRef($gr);
$html = '';
$kml = new kmlFile();
$kml->atom = true;
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', "{$gr} :: Geograph SuperLayer");
$links = new kmlPrimative('Folder');
$links->setItem('name', 'Next Level...');
$prefix = $db->GetRow('select * from gridprefix where prefix=' . $db->Quote($square->gridsquare) . ' limit 1');
$left = $prefix['origin_x'] + intval($square->eastings / 10) * 10;
$right = $left + 10 - 1;
$bottom = $prefix['origin_y'] + intval($square->northings / 10) * 10;
$top = $bottom + 10 - 1;
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$photos = $db->GetAll("select \r\ngridimage_id,grid_reference,title,title2,imagecount,view_direction,natgrlen,realname,\r\nwgs84_lat,wgs84_long\r\nfrom gridimage_kml \r\nwhere {$sql_where} and tile = 0\r\norder by null");
foreach ($photos as $id => $entry) {
$gr = $_GET['gr'];
preg_match('/^([A-Z]{1,3})(\\d\\d)(\\d|_)(\\d\\d)(\\d|_)$/', strtoupper($gr), $matches);
if ($matches[3] == '_') {
    $sql_where = " and nateastings = 0";
    $gr2 = $matches[1] . $matches[2] . $matches[4];
} else {
    $sql_where = " and nateastings != 0";
    //to stop XX0XX0 matching 4fig GRs
    $sql_where .= " and ((nateastings div 100) mod 10) = " . $matches[3];
    $sql_where .= " and ((natnorthings div 100) mod 10) = " . $matches[5];
    $gr2 = $gr;
}
$square = new GridSquare();
$grid_ok = $square->setByFullGridRef($gr2);
$html = '';
$kml = new kmlFile();
$kml->atom = true;
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', "{$gr} :: Geograph SuperLayer");
$sql_where = "gridsquare_id={$square->gridsquare_id}" . $sql_where;
$photos = $db->GetAll($sql = "select \r\n\tgridimage_id,title,title2,gi.realname as credit_realname,if(gi.realname!='',gi.realname,user.realname) as realname,user.user_id,comment,nateastings,natnorthings,natgrlen,view_direction\r\n\tfrom gridimage gi\r\n\t\t inner join user using(user_id)\r\n\twhere {$sql_where}\r\n\torder by null");
foreach ($photos as $id => $entry) {
    $title = combineTexts($entry['title'], $entry['title2']);
    if ($entry['nateastings']) {
        if ($entry['natgrlen'] == 6) {
            $entry['nateastings'] += 50;
            $entry['natnorthings'] += 50;
        }
        list($wgs84_lat, $wgs84_long) = $conv->national_to_wgs84($entry['nateastings'], $entry['natnorthings'], $square->reference_index);
    } else {
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
require_once 'geograph/kmlfile2.class.php';
require_once 'geograph/conversions.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$conv = new Conversions();
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
$kml = new kmlFile();
$kml->atom = true;
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$kml->filename = "Geograph-Members.kml";
$folder = $kml->addChild('Document');
$folder->setItem('name', "Geograph British Isles Members");
$users = $db->GetAssoc("select\r\n\t\tuser.user_id,nickname,user.realname,images,gs.x,gs.y,gs.reference_index\r\n\t\tfrom user\r\n\t\t\tleft join user_stat using (user_id)\r\n\t\t\tinner join gridsquare gs on (home_gridsquare = gridsquare_id)\r\n\t\torder by realname");
foreach ($users as $user_id => $user) {
    list($wgs84_lat, $wgs84_long) = $conv->internal_to_wgs84($user['x'], $user['y']);
    $point = new kmlPoint($wgs84_lat, $wgs84_long);
    $placemark = new kmlPlacemark($user_id, $user['realname'] . ' :: ' . $user['images'], $point);
    $placemark->useCredit($entry['realname'], "http://{$_SERVER['HTTP_HOST']}/profile/{$user_id}");
    if (empty($user['nickname'])) {
        $placemark->setItemCDATA('description', $placemark->link);
    } else {
        $placemark->setItemCDATA('description', "Nickname: {$user['nickname']}<br/>{$placemark->link}");
require_once 'geograph/map.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
require_once 'geograph/conversions.class.php';
$conv = new Conversions();
$gr = $_GET['gr'];
$square = new GridSquare();
$grid_ok = $square->setByFullGridRef($gr);
$html = '';
$kml = new kmlFile();
$kml->atom = true;
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', "{$gr} :: Geograph SuperLayer");
$links = new kmlPrimative('Folder');
$links->setItem('name', 'Next Level...');
$prefix = $db->GetRow('select * from gridprefix where prefix=' . $db->Quote($square->gridsquare) . ' limit 1');
$left = $prefix['origin_x'] + intval($square->eastings / 5) * 5;
$right = $left + 5 - 1;
$bottom = $prefix['origin_y'] + intval($square->northings / 5) * 5;
$top = $bottom + 5 - 1;
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$photos = $db->GetAll("select \r\ngridimage_id,grid_reference,title,title2,imagecount,user_id,realname,x,y,view_direction,credit_realname,realname,\r\nwgs84_lat,wgs84_long\r\nfrom gridimage_kml \r\nwhere {$sql_where}\r\norder by null");
foreach ($photos as $id => $entry) {
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
require_once 'geograph/kmlfile2.class.php';
init_session();
$kml = new kmlFile();
$document = $kml->addChild('Document');
$point = new kmlPoint(rand(5900, 6000) / 100, rand(100, 200) / 100);
$placemark = $document->addChild(new kmlPlacemark_Photo(null, 'test', $point));
$placemark->setTimeStamp(date('Y-m-d'));
$placemark->useImageAsIcon("http://" . $_SERVER['HTTP_HOST'] . "/templates/basic/img/guide1.jpg");
$point2 = new kmlPoint(rand(5900, 6000) / 100, rand(100, 200) / 100);
$placemark->addPhotographerPoint($point2);
if (isset($_GET['download'])) {
    $kml->outputKML();
    exit;
}
print "<a href=?download>Open in Google Earth</a><br/>";
print "<textarea rows=35 style=width:100%>";
print $kml->returnKML();
print "</textarea>";
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
require_once 'geograph/kmlfile2.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$kml = new kmlFile();
$folder = $kml->addChild('Document');
$Style = $folder->addChild('Style', 'c2');
$IconStyle = $Style->addChild('IconStyle');
$IconStyle->setItem('scale', 0);
$LabelStyle = $Style->addChild('LabelStyle');
$LabelStyle->setItem('color', 'ff00aaff');
$Style = $folder->addChild('Style', 'c1');
$IconStyle = $Style->addChild('IconStyle');
$IconStyle->setItem('scale', 0);
$LabelStyle = $Style->addChild('LabelStyle');
$LabelStyle->setItem('color', 'ff0000ff');
$folder->addHoverStyle('def');
$folder->addHoverStyle('p1', 1, 1.1, 'cam1.png;cam1h.png', "http://" . $CONF['KML_HOST'] . '/kml/images/');
$folder->addHoverStyle('p1d', 1, 1.1, 'cam1d.png;cam1dh.png', "http://" . $CONF['KML_HOST'] . '/kml/images/');
$folder->addHoverStyle('p1r', 1, 1.1, 'cam1r.png;cam1rh.png', "http://" . $CONF['KML_HOST'] . '/kml/images/');
Exemple #9
0
     header("Status:302 Found");
     $url = "http://maps.live.com/default.aspx?v=2&mapurl={$url}";
     //no need to urlencode as we using rest style url
     header("Location:{$url}");
     print "<a href=\"{$url}\">Open 'Maps Live'</a>";
     exit;
 } elseif (isset($_REQUEST['type']) && $_REQUEST['type'] == 'maps') {
     header("Status:302 Found");
     $url = "http://maps.google.co.uk/maps?q={$url}";
     //no need to urlencode as we using rest style url
     header("Location:{$url}");
     print "<a href=\"{$url}\">Open Google Maps</a>";
     exit;
 } else {
     customExpiresHeader(3600 * 24 * 14, true);
     $kml = new kmlFile();
     $kml->filename = "Geograph.kml";
     $NetworkLink = $kml->addChild('NetworkLink');
     $NetworkLink->setItem('name', 'Geograph NetworkLink');
     $NetworkLink->setItemCDATA('description', "Images<i>{$engine->criteria->searchdesc}</i>");
     $NetworkLink->setItem('open', 0);
     $UrlTag = $NetworkLink->useUrl($url);
     $NetworkLink->setItem('visibility', 0);
     if ($_REQUEST['type'] == 'time') {
         $UrlTag->setItem('refreshMode', 'onInterval');
         $UrlTag->setItem('refreshInterval', intval($_REQUEST['refresh']));
     } else {
         $UrlTag->setItem('viewRefreshMode', 'onStop');
         $UrlTag->setItem('viewRefreshTime', 4);
         $UrlTag->setItem('viewFormat', 'BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]&amp;LOOKAT=[lookatLon],[lookatLat],[lookatRange],[lookatTilt],[lookatHeading],[horizFov],[vertFov]');
     }
Exemple #10
0
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
init_session();
$kml = new kmlFile();
$document = $kml->addChild('Document');
$document->setItem('name', 'geotest');
$document->addHoverStyle();
$folder = $document->addChild('Folder');
$folder->setItem('name', 'geotest');
foreach (range(1, 2) as $i) {
    $point = new kmlPoint(rand(-9000, 9000) / 100, rand(-18000, 18000) / 100);
    $placemark = $folder->addChild(new kmlPlacemark(null, 'test' . $i, $point));
    $placemark->makeFloating();
    $placemark->useHoverStyle();
    $placemark->setTimeStamp(date('Y-m-d'));
    #$placemark->useImageAsIcon('bla.png');
    #or $placemark->makeFloating()->useHoverStyle()->useImageAsIcon('bla.png');
}
if (!isset($_GET['nolinks'])) {
 */
require_once 'geograph/global.inc.php';
require_once 'geograph/kmlfile.class.php';
require_once 'geograph/kmlfile2.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
require_once 'geograph/conversions.class.php';
$conv = new Conversions();
$html = '';
$kml = new kmlFile();
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', 'Geograph SuperLayer');
$date = date(DATE_RFC850);
$folder->setItemCDATA('description', <<<END_HTML
<table bgcolor="#000066" border="0"><tr bgcolor="#000066"><td bgcolor="#000066">
<a href="http://{$_SERVER['HTTP_HOST']}/"><img src="http://{$_SERVER['HTTP_HOST']}/templates/basic/img/logo.gif" height="74" width="257"/></a>
</td></tr></table>

<p><i>The Geograph British Isles project aims to collect geographically representative photographs and information for every square kilometre of the UK and the Republic of Ireland, and you can be part of it.</i></p>

<p>This SuperLayer allows full access to the thousends of images contributed to Geograph since March 2005, the view starts depicting a coarse overview of the current coverage, zooming in reveals more detail until pictures themselves become visible.</p>

<p>Click on the Camera Icon or Thumbnails to view a bigger image, and follow the link to view the full resolution image on the geograph website.</p>
require_once 'geograph/gridimage.class.php';
require_once 'geograph/gridsquare.class.php';
require_once 'geograph/map.class.php';
if (!isLocalIPAddress()) {
    init_session();
    $USER->mustHavePerm("admin");
}
$db = NewADOConnection($GLOBALS['DSN']);
if (!$db) {
    die('Database connection failed');
}
require_once 'geograph/conversions.class.php';
$conv = new Conversions();
$gr = $_GET['gr'];
$html = '';
$kml = new kmlFile();
$stylefile = "http://{$CONF['KML_HOST']}/kml/style.kmz";
$folder = $kml->addChild('Document');
$folder->setItem('name', "{$gr} :: Geograph SuperLayer");
$links = new kmlPrimative('Folder');
$links->setItem('name', 'Next Level...');
$prefix = $db->GetRow('select * from gridprefix where prefix=' . $db->Quote($gr) . ' limit 1');
$left = $prefix['origin_x'];
$right = $prefix['origin_x'] + $prefix['width'] - 1;
$top = $prefix['origin_y'] + $prefix['height'] - 1;
$bottom = $prefix['origin_y'];
$rectangle = "'POLYGON(({$left} {$bottom},{$right} {$bottom},{$right} {$top},{$left} {$top},{$left} {$bottom}))'";
$sql_where = "CONTAINS(GeomFromText({$rectangle}),point_xy)";
$sql_where .= ' and reference_index = ' . $prefix['reference_index'] . ' ';
$letterlength = $CONF['gridpreflen'][$prefix['reference_index']];
$sql_column = "concat(substring(grid_reference,1,{$letterlength}),substring(grid_reference,{$letterlength}+1,1) div 2 * 2,substring(grid_reference,{$letterlength}+3,1) div 2 * 2)";