|
<?php $camurl='http://www.yoursite.com/cam.jpg'; //URL for webcam $GPSinfo = file ('/home/www/GPSinfo.txt'); if (!$GPSinfo) { echo '<p>Unable to open remote file.</p>'; exit; } $position = explode(",", trim($GPSinfo[0])); list ($date, $lat, $lon, $altitude, $speed, $dir, $refresh ) = array(trim($position[0]), trim($position[1]), trim($position[2]), trim($position[3]), trim($position[4]), trim($position[5]), trim($position[6])); $cardir = preg_replace ("/\d\..*/" , "" , $dir); $carpic="http://www.pathtocarpics.com/car_icons/car$cardir.png"; echo <<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"xmlns:v="urn:schemas-microsoft-com:vml"> <style type="text/css"> v\:* { behavior:url(#default#VML); } </style> <head> <title>CPS Google Map Test Page</title> <script src="http://maps.google.com/maps?file=api&v=1&key=AXP9c-AXGAxf-sbhkg" type="text/javascript"> </script> <script type="text/javascript"> //<![CDATA[ function onLoad() { var map = new GMap(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.centerAndZoom(new GPoint($lon, $lat), 10); // Creates a marker whose info window displays the given number function createMarker(point, number) { var marker = new GMarker(point, icon); // Show this marker's index in the info window when it is clicked var html = "<b>Chaser #" + number + "</b><br>Time=$date, Altitude=$altitude ft<br>Speed=$speed MPH, Direction=$dir degrees<br><img src=\"$camurl\"><br>dashcam image"; GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); } ); return marker; } var point = new GPoint($lon, $lat); var icon = new GIcon(); icon.image = "$carpic"; icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; icon.iconSize = new GSize(25, 35); icon.shadowSize = new GSize(30, 30); icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(5, 1); var marker = createMarker(point, 1); map.addOverlay(marker); } //]]> </script> </head> <body onload="onLoad()" text="#000000" bgcolor="#000000"> <p align="center"><font color="#FFFFFF"> CPS info page <a href ="/projects/GPSlive.php">HERE</a><br> Problems viewing Google map? Original CPS map page <a href="/cgi-bin/GPSlive.cgi">HERE</a> <div id="map" style="width: 700px; height: 500px"></div></p> </body> </html> EOT; ?> |
|
|