Trying to understand refreshMode, onChange

617 views
Skip to first unread message

GRiker

unread,
Dec 27, 2007, 2:29:43 PM12/27/07
to KML Developer Support - KML Server Side Scripting
Hi folks,

I'm trying to understand how <refreshMode><onChange> works.

I currently have a NetworkLink that refreshes on a periodic interval,
but I'd prefer to set it up so that I can somehow trigger a reload of
the NetworkLink manually.

I've read the documentation, which says that using refreshMode =
onChange will refresh when the Link value changes. But I don't
understand how I can cause the Link value to change.

Is it possible for me to do something that causes a NetworkLink to
reload under program control?

Is this the intent of onChange, or am I completely misunderstanding
its purpose?

Thanks for any help you can provide.

G

barryhunter [KML Guru]

unread,
Dec 27, 2007, 4:52:40 PM12/27/07
to KML Developer Support - KML Server Side Scripting
the Link of networkLink can change as result of a Update command, see
http://code.google.com/apis/kml/documentation/updates.html
so that is where onChange is intended (or by default)

There is no real way to have a 'on demand' refresh from the server
end.

Although the update mechanism just mentioned could be used to fairly
lightweight do this, two slight variations:

1) have a never refreshed network link, that is just updated by a
periodically fetched network link, that most of the time returns
nothing, but if there is something, updates the content using the
Update mechanism.

2) have a main networklink with onChange, and then a second link that
refreshes often, like above, but if there is new content it refreshes
the main link by for example incrementing a serial number in the url


Alternatively if you meaning a local program (on the same machine)
then you can probably do something with the COM API (or apple script)

GRiker

unread,
Dec 29, 2007, 5:06:16 PM12/29/07
to KML Developer Support - KML Server Side Scripting
Thanks Barry, I think I understand. I will try your suggestions.

G

KoflAIR

unread,
Feb 11, 2008, 4:27:59 AM2/11/08
to KML Developer Support - KML Server Side Scripting
Hi barryhunter,

I think you mean an often refreshing NetworkLinkControl that updates
the NetworkLink. Anyway, it seems as if this answer is the key to my
problem also. I'll try it out in the evening. Great thanks!

GRiker

unread,
Feb 11, 2008, 7:15:55 AM2/11/08
to KML Developer Support - KML Server Side Scripting
Here's where I ended up with this.

Initially I had a NetworkLink that loaded NetworkLinkControl #1, that
in turn loaded NetworkLinkControl #2, which refreshed onInterval.
This approach models what's in the online documentation.

However, it didn't make sense to me to use two NLCs - why not just
have #1 refresh onInterval?

So I changed the configuration. NLC #1 now refreshes onInterval, and
all subsquent changes to the original NetworkLink are carried out
through NLC #1. For me, this was a much simpler implementation.

G
> > the main link by for example incrementing a serial number in the url- Hide quoted text -
>
> - Show quoted text -

KoflAIR

unread,
Feb 20, 2008, 5:14:14 PM2/20/08
to KML Developer Support - KML Server Side Scripting
BTW, my solution works!
Instead of a version counter, I simply use a random number appending
to the link parameters. ;-)
Reply all
Reply to author
Forward
0 new messages