[OpenLayers-Users] KML NetworkLink and auto-refresh
Christopher Schmidt
crschmidt at metacarta.com
Wed May 13 07:33:57 EDT 2009
On Wed, May 13, 2009 at 12:57:30PM +0200, Peter Peterse wrote:
> Hello,
>
> I've also tried this. In my case the old KML stays on the layer. So parts
> which are deleted stays on the map. Parts with a transparancy becomes
> darker and darker after every request.
>
> Can somebody help use?
There is no way to delay the removal of features until the new data is
loaded in the GML layer. If you don't mind a 'blink' while new data is
loaded, you can simply use:
layer.setUrl('foo.kml');
You may want to icnlude a 'random' parameter:
layer.setUrl('foo.kml?_salt='+Math.random())
To break through caches.
If you want to delay the removal of features until more are loaded, you
should probably use an HTTP Protocol and a fixed strategy with a
refresh() call. This will delay removing of features until more features
are loaded (in my experience, at least), which seems like what you want.
The documentation on this aspect of the project is currently somewhat
limited.
-- Chris
> Peter.
>
>
> > Thanks Dan, I'll have to give this a try.
> >
> > I notice that your timer is going off every 10 minutes...how much data are
> > you loading from the KML file? Is there much in the way of a noticeable
> > flicker when you reload the layer (i.e. does all of the data completely
> > disappear for a few seconds while the KML file is parsed and reloaded)?
> >
> > I'd be looking to reload a layer containing between 20-100 text objects
> > every 5 seconds or so and I'm not sure what the performance will be like
> > under those conditions.
> >
> > Cheers,
> >
> > Andrew
> >
> > On Wed, May 13, 2009 at 1:35 AM, ChiefDan <ChiefDan at gmail.com> wrote:
> >
> >>
> >> Andrew,
> >> Not sure if you found a solution, if not, this is what I've done.
> >>
> >> In the map init function, set a timer:
> >>
> >> window.setInterval(raingaugeRefreshData, 600000, rainGauges);
> >>
> >> Then in the timer service function:
> >> function raingaugeRefreshData(layer)
> >> {
> >> layer.loaded = false;
> >> layer.setVisibility(true);
> >> }
> >> By setting loaded to false then calling setVisibility(), openlayers goes
> >> and
> >> grabs the kml file again.
> >>
> >> Hope this helps.
> >>
> >> Dan
> >> --
> >> View this message in context:
> >> http://n2.nabble.com/KML-NetworkLink-and-auto-refresh-tp2531433p2870627.html
> >> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> Users mailing list
> >> Users at openlayers.org
> >> http://openlayers.org/mailman/listinfo/users
> >>
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list