I'm using KML to load an image overlay, and then I'm trying to change camera view values such as altitude using NetworkLinkControl. None of my NetworkLinkControl updates are reflected in the GE plugin. I've done quite a bit of research on this issue to no avail. Any help would be appreciated.
Here are the details:
The process starts with loading a NetworkLink KML file:
google.earth.fetchKml(ge, href, function(kmlObject) { ...
inside which the .appendChild() is done like this:
walkKmlDom(kmlObject, function() {
if(this.getType().match('KmlNetworkLink')) {
ge.getFeatures().appendChild(this);
//There are 2 NetworkLinks
if(this.getLink().getHref().match('nodesc')) {
networkLinkPhoto = this;
}
else if(this.getLink().getHref().match('control')){
networkLinkControl = this; //will use this for updates later
}
}
});
The .fetchKml() above loads the following KML 1:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Photos</name>
<open>1</open>
<Style id="photoStyle">
<IconStyle>
<Icon>
<href>http://hostname/images/ge_icon.png</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
</Style>
<Folder>
<name>My Photo</name>
<open>1</open>
<visibility>1</visibility>
<NetworkLink>
<name>My Photo</name>
<open>1</open>
<Link>
<href>http://hostname/images/10000244.kml?auth_key=e34962fce2df4829b0e86870c9e834da&nodesc=1</href>
</Link>
</NetworkLink>
<NetworkLink>
<name>Updater</name>
<Link>
<href>http://hostname/placements/10000244/control?auth_key=e34962fce2df4829b0e86870c9e834da</href>
<refreshMode>onChange</refreshMode>
</Link>
</NetworkLink>
</Folder>
</Document>
</kml>
Each of the two NetworkLink loads it's own KML file through URLs defined in <Link>.
First one is My Photo (overlay) KML 2:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Photos</name>
<open>1</open>
<Style id="photoStyle">
<IconStyle>
<Icon>
<href>http://hostname/images/ge_icon.png</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
</Style>
<PhotoOverlay id="image_10000244">
<name>My Photo</name>
<Snippet maxLines="1">
<![CDATA[<a href="#image_10000244">Enter Photo</a>]]>
</Snippet>
<Camera>
<longitude>-122.668</longitude>
<latitude>45.5069</latitude>
<altitude>1.0</altitude>
<heading>66.0</heading>
<tilt>90.0</tilt>
<roll>0.0</roll>
</Camera>
<styleUrl>#photoStyle</styleUrl>
<color>feffffff</color>
<Icon>
<href>http://hostname/get_ge_tile/10000244/$[level]/$[y]/$[x]?auth_key=e34962fce2df4829b0e86870c9e834da</href>
</Icon>
<rotation>0.0</rotation>
<ViewVolume>
<leftFov>-17.5</leftFov>
<rightFov>17.5</rightFov>
<bottomFov>0.0</bottomFov>
<topFov>17.5</topFov>
<near>550.0</near>
</ViewVolume>
<ImagePyramid>
<tileSize>256</tileSize>
<maxWidth>16000</maxWidth>
<maxHeight>8000</maxHeight>
<gridOrigin>upperLeft</gridOrigin>
</ImagePyramid>
<Point>
<coordinates>-122.668,45.5069</coordinates>
</Point>
<shape>sphere</shape>
</PhotoOverlay>
</Document>
</kml>
The second one is Updater KML 3:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Photos</name>
<open>1</open>
<Style id="photoStyle">
<IconStyle>
<Icon>
<href>http://hostname/images/ge_icon.png</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
</Style>
<NetworkLinkControl>
<Update>
<targetHref>http://hostname/images/10000244.kml?auth_key=e34962fce2df4829b0e86870c9e834da&nodesc=1</targetHref>
<Change>
<PhotoOverlay targetId="image_10000244">
<Camera></Camera>
<ViewVolume></ViewVolume>
<Point></Point>
</PhotoOverlay>
</Change>
</Update>
</NetworkLinkControl>
</Document>
</kml>
The GE plugin now has the KMLs loaded, the placemark is placed at the specified coordinates, and double clicking the placemark enters the photo view mode.
To change the photo's altitude, javascript API requests the update:
var updateHref='http://http://hostname/netlinkcontrol/10000244?&altitude=55&auth_key=e34962fce2df4829b0e86870c9e834da'
networkLinkControl.getLink().setHref(updateHref);
The server responds (indicated in server log) with KML 4:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>Photos</name>
<open>1</open>
<Style id="photoStyle">
<IconStyle>
<Icon>
<href>http://hostname/images/ge_icon.png</href>
</Icon>
</IconStyle>
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
</Style>
<NetworkLinkControl>
<Update>
<targetHref>http://hostname/images/10000244.kml?auth_key=e34962fce2df4829b0e86870c9e834da&nodesc=1</targetHref>
<Change>
<PhotoOverlay targetId="image_10000244">
<Camera>
<altitude>55</altitude>
</Camera>
<ViewVolume></ViewVolume>
<Point></Point>
</PhotoOverlay>
</Change>
</Update>
</NetworkLinkControl>
</Document>
</kml>
This should work because:
<refreshMode>onChange</refreshMode>is set for the Updater<NetworkLink>in KML 1, andnetworkLinkControl.getLink().setHref()is making the change.<PhotoOverlay targetId="image_10000244">in KML 4 is correctly targeting<PhotoOverlay id="image_10000244">in KML 2<targetHref>in KML 4 is targeting the correct<href>in KML 1
GE plugin however doesn't display the altitude change. I've tried changing this value through javascript API, which works. But why isn't the KML method working? Any ideas would be appreciated.