NetworkLinkControl and LookAt problem

74 views
Skip to first unread message

ETRo

unread,
Jul 29, 2010, 7:55:56 AM7/29/10
to KML Developer Support - KML Server Side Scripting
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.




barryhunter (KML Guru)

unread,
Jul 29, 2010, 12:52:15 PM7/29/10
to KML Developer Support - KML Server Side Scripting
In 1. did you specifically try putting the <LookAt> inside a
<NetworkLinkControl> tag. The NetworkLink pointing at
NetworkLinkControl-Update.kml needs flyToView=1


In 2. did the <LookAt> remain active if you simply return a blank kml
file <kml></kml>

You could also try returning 204 No Content. But otehrs have reported
issues with that in later versions of GE.

ETRo

unread,
Jul 30, 2010, 11:31:18 AM7/30/10
to KML Developer Support - KML Server Side Scripting
Hi, thanks a lot for your advice.

In 1., if I put flyToView=1 in Update-load.kml (which loads
NetworkLinkControl-Update.kml), then the view is updated, but this
happens every couple of seconds, whenever the NetworkLinkControl-
Update.kml is refreshed. (which I guess is what should be happening
for flyToView=1). The problem is that even if I return an empty kml
file in NetworkLinkControl-Update.kml (i.e. one without a LookAt, and
even without a network link), GE client can't seem to be able to
"forget" the last LookAt it has in memory and keeps resetting the view
every few seconds.

For 2, I tried both returning an empty kml and returning 204 No
Content. In both cases, the last view in the memory of GE client
remains active, and the client resets it every few seconds.

In both cases, my problem seems to be that once I set flyToView=1 in a
network link client side and once I provide a LookAt in the server
side file this network link points to, there is no way to override
that. GE client seems to want to fly to *something* so it will fly to
whatever it last read into memory.

Is this a bug ?
Reply all
Reply to author
Forward
0 new messages