Google Earth Plug, KML , Touring and Autoplay

141 views
Skip to first unread message

phil....@sunandshadows.net

unread,
May 8, 2009, 4:43:51 PM5/8/09
to KML Developer Support - Google Earth Plug-in
Hello,

I am wanting to embed KML files in a HTML website through the API,
including one which is a Tour as described in the Touring in KML
documentation.

I started by checking my KML tour in the GE application. I opened the
file , checked the title "Play Me" and the "Play Tour" button. The
tour worked OK.

I then went to the "Add Gadget to Your Web" and used the Embedded Tour
Player. I chose the "Autoplay Tour" option. Again, it worked OK

Here is my HMTL for the API:

<html>
<head>
<title>Spectra Dials Google Earth API and KmlNetworkLink</title>

<script type="text/javascript" src="http://www.google.com/jsapi?
hl=en&amp;key=ABQIAAAAOq32hBhJMBlsajEztAB6SxRkRR4kiwpGADDA0TRNXlb1BQIYpRQqL_q_9xR4TVEcb3XJnw8Hj9mfdw"></
script>
<script>
// This webpage contains the Javascript and HTML necessary to
embed the Google Earth in your website together with:
// the view panel's dimensions and the Navigate Control


google.load('earth', '1');

var ge = null;

function init() {
google.earth.createInstance('map3d', initCallback,
failureCallback);
}

function initCallback(pluginInstance) {
ge = pluginInstance;
ge.getWindow().setVisibility(true);
// add Navigate Control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// ENABLE Borders
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);

addKMLFromUrl('http://www.shropshiredials.net/DayNight.kml');

addKMLFromUrl('http://www.shropshiredials.net/EarthRotation.kml');

}

function addKMLFromUrl(kmlUrl) {
var link = ge.createLink('');
link.setHref(kmlUrl);

var networkLink = ge.createNetworkLink('');
networkLink.setLink(link);
networkLink.setFlyToView(true);

ge.getFeatures().appendChild(networkLink);
}

function failureCallback(errorCode) {
}
</script>
</head>
<body bgcolor="#330033" onload="init();">

<table width="1286" border="0" cellpadding="0" cellspacing="0"
bgcolor="#330033">
<tr>
<td width="1286" height="1"></td>
</tr>
</table>

<table style="width: 100%; height: 400px;">
<tr>

<td style="width: 300px" valign="top">
<table style="width: 300px">
<tr>
<td style="width: 50%" valign="top">

</td>
<td style="width: 50%" valign="top">


</td>
</tr>
</table>
<div id="route-details"></div>
</td>

<td style="width: 67%" valign="top">
<div id="map3d_container" style="border: 1px solid #000; height:
600px;">
<div id="map3d" style="height: 100%;"></div>
</div>
<div id="status"></div>
</td>
<td style="width: 33%" valign="top">

</td>
</tr>
</table>


</body>
</html>

The first network link works OK but the second network link, the
EarthRotation.kml file, which contains the Playlist, appears not to
flyto the ten or so tour points but goes directly to the "The End"
placemark.

I feel sure that this is to do with the Touring Autoplay option but I
can't find a solution.

Here is the link to my code : http://www.shropshiredials.net/EarthRotation.html

I'd be grateful for advice

Phil
















Reply all
Reply to author
Forward
0 new messages