Google
Official Google Earth Download Site

Google Earth Community

Earth >> Dynamic Data Layers

Boehringer
First Post


Reged: 03/29/06
Posts: 1
Network Link - Fly to view on Refresh
      03/29/06 07:09 AM

Hi,

I have created a network link (see attached TLSPos.kmz file) that displays an arrow (Navipfeil.gif) on Google Earth on the current position of the train. This position is calculated from a train location system, which is also able to get the heading. However when I used the "Fly to View on Refresh" option the arrow is displayed correct and GE centers the position but the direction of the view is to north and not the heading used in LookAt.

However, if I make a double click on the network link the correct heading is used in Google Earth.

Question: is it possible to use the "Fly to View on Refresh" option with a given heading and not the north direction.

Thanks for any help.


Source code: TLSPos.kmz

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<NetworkLink>
<name>Aktuelle Zugposition</name>
<open>1</open>
<description>Aktuelle Zugposition wird alle 20 Sekunden erneuert. Fuer mehr Infos bitte auf den Zug klicken.</description>
<flyToView>1</flyToView>
<Url>
<href>http://mrtstud1/DemoOrt/ReadTLSPos.php</href>
<refreshMode>onInterval</refreshMode>
<refreshInterval>10</refreshInterval>
<viewRefreshMode>onStop</viewRefreshMode>
<viewRefreshTime>10</viewRefreshTime>
<viewBoundScale>1.5</viewBoundScale>
</Url>
</NetworkLink>
</kml>



Source code: ReadTLSPos.php

<?php

// Build up empty error message
$error = '';

// get the time
$timesnap = date("H:i:s");


// get the train position from the mySQL-server

// connect to the mySQL-server
$dbcnx = mysql_connect('xxx:3306','xxx','xxxx');
if (!$dbcnx)
{
$error .= 'Unable to connect to the database server at this time.';
}


// get the data base
if (!@mysql_select_db('map'))
{
$error .= 'Unable to locate the map database at this time.';
}


// do the query
$sql = 'SELECT * FROM AktuelleZugPos';
$result = @mysql_query($sql);
if (!$result)
{
$error .= 'Error reading table: AktuelleZugPos';
}


// start writing kml-file
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<kml xmlns="http://earth.google.com/kml/2.0">';
$response .= '<Document>';

// Fetch the data
while ($row = mysql_fetch_array($result))
{
$TrainNo = $row['TrainNo'];
$WGS84Lat = $row['WGS84Lat'];
$WGS84Lon = $row['WGS84Lon'];
$Velo = $row['Velo'];
$Heading = $row['Heading'];
$MatchingError = $row['MatchingError'];
$TrackID = $row['TrackID'];
// $error .= ' '.$TrainNo.', '.$WGS84Lat.', '.$WGS84Lon.', '.$Velo.', '.$Heading.', '.$MatchingError.', '.$TrackID.';


$response .= '<Placemark>';
$response .= '<name>Zug: '.$TrainNo.', Zeit: '.$timesnap.'</name>';
if(!$error)
{
$response .= '<description><![CDATA[Zeigt die aktuelle Position des Zuges Nr. '.$TrainNo.' an!<br>
<br>Geograph. Breite (WGS84): '.$WGS84Lat.' °
<br>Geograph. Laenge (WGS84): '.$WGS84Lon.' °
<br>Geschwindigkeit: '.$Velo.' km/h
<br>Heading: '.$Heading.' °
<br>Fehler: '.$MatchingError.' m <br>
<br>GleisID: '.$GleisID.']]></description>';
}
else
{
$response .= '<description><![CDATA[ERROR: '.$error.'<br>'.mysql_errno().'<br>'.mysql_error().']]></description>';
}
$response .= '<LookAt>';
$response .= '<longitude>'.$WGS84Lon.'</longitude><latitude>'.$WGS84Lat.'</latitude>';
$response .= '<range>1000</range><tilt>0</tilt><heading>'.$Heading.'</heading>';
$response .= '</LookAt>';

$response .= '<Style><IconStyle><scale>0.8</scale>';
$response .= '<Icon><href>http://mrtstud1/DemoOrt/Navipfeil.gif</href></Icon>';
$response .= '</IconStyle><LabelStyle><color>ff00ffff</color></LabelStyle></Style>'; //ff00ffff

$response .= '<Point><extrude>1</extrude><altitudeMode>relativeToGround</altitudeMode>';
$response .= '<coordinates>'.$WGS84Lon.','.$WGS84Lat.',100</coordinates>';
$response .= '</Point>';
$response .= '</Placemark>';

} // while


$response .= '</Document>';
$response .= '</kml>';

// close the connection
mysql_close($dbcnx);

// return the kml-file
echo $response;
?>

Post Extras Print Post   Remind Me!     Report this Post


Entire topic
Subject Posted by Posted on
* Network Link - Fly to view on Refresh Boehringer 03/29/06 07:09 AM


Extra information
0 registered and 11 anonymous users are browsing this forum.

Moderator:  Hill, Jumble, Kempster, mcshea98, jeffryv, dulce, esterrett, NormB, Frank_McVey, BeadieJay, TheLedge, Cyclonic, no_stranger, LuciaM, tekgergedan, Noisette, danescombe, Michal_Drewniak, mutex 



Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Thread views: 2082

Rate this thread

Jump to

earth.google.com    bbs.keyhole.com

*
UBB.threads™ 6.5.1.1