Hi,
I am trying to cause Google Earth to display some data and update the
current view without user interaction, upon a certain event occurring
on the server.
Specifically, when some condition changes on the server, the client
should display a new placemark and should update the "LookAt"
parameters as instructed by the server.
Unfortunately using the Google Earth plugin and its api is not an
option for me because my platform is Linux.
I tried the following two approaches.
1. Update mechanism of Network Links Control.
Following an example posted by Google, I load two files on the client:
Point-Load.kml and Update-load.kml.
* Point-Load.kml contains a network link with href
myserver.com/
Point.kml, which in turn contains one placemarker and a LookAt. Point-
Load.kml has flyToView=1 and refreshMode=onChange.
* Update-load.kml contains a network link with href
myserver.com/
NetworkLinkControl-Update.kml which contains a network link control
with some Change elements inside it and the targetHref set to
myserver.com/Point.kml.
Update-load.kml has refreshMode=onInterval and a refresh period of a
few seconds.
I load both Point-Load.kml and Update-load.kml into the Google Earth
client. Then If I manually (for now) change the contents of
NetworkLinkControl-Update.kml server side, I can see the placemark
updating correctly in the client. I don't seem to be able like this to
change the LookAt. I tried putting a LookAt in the NetworkLinkControl-
Update.kml (server side), but this only updates the client view if I
double-click on the respective network link in the client.
2. Using the cookie element of Network Link Control.
My second attempt was to have one network link nl1.kml referring to a
perl script (
get_placemark.pl) on the server. nl1.kml refreshes
onInterval, every few seconds. It has flyToView is set to 1.
get_placemerk.pl returns a network link control which contains a
<cookie> element.
By keeping track of the contents of this cookie, the
get_placemark.pl
returns various placemarks, which are correctly displayed in the
client. However, if
get_placemark.pl also returns a LookAt element
once, this LookAt element seems to remain active in the client, even
if subsequent calls to
get_placemark.pl no longer have a LookAt in
them. The effect is that the client resets the view every few seconds
when it updates. This is not what should be happening.
The point of all this is to ultimately be able to update the Google
Earth display in response to a message sent to it by another
application. The problem is that I also need to update the view and I
don't want the user to have to manually refresh something in the
client, to see the new data (and view).
I'd really appreciate some advice on whether this is possible or not.