Ejemplo n.º 1
0
    $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) {
    $point = new kmlPoint($entry['wgs84_lat'], $entry['wgs84_long']);
    $title = combineTexts($entry['title'], $entry['title2']);
    if ($entry['imagecount'] == 1) {
Ejemplo n.º 2
0
 * 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-Events.kml";
$NetworkLink = $kml->addChild('NetworkLink');
$NetworkLink->setItem('name', 'Geograph Events');
$NetworkLink->setItemCDATA('description', "Upcoming Geograph Events");
$NetworkLink->setItem('open', 1);
$UrlTag = $NetworkLink->useUrl("http://{$_SERVER['HTTP_HOST']}/events/feed.kml");
$NetworkLink->setItem('visibility', 1);
$UrlTag->setItem('refreshMode', 'onInterval');
$UrlTag->setItem('refreshInterval', 3600);
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>";
} else {
    $kml->outputKML();
}
Ejemplo n.º 3
0
 * 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
);
    $NetworkLink->setItem('open', 0);
    $UrlTag = $NetworkLink->useUrl("http://{$_SERVER['HTTP_HOST']}/earth.php?simple=1" . ($i ? "&i={$i}" : ''));
    $NetworkLink->setItem('visibility', 0);
    $UrlTag->setItem('viewRefreshMode', 'onStop');
Ejemplo n.º 4
0
 * 
 * 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>";
exit;