[OpenLayers-Users] Forcing a redraw of a Vector Layer
Kris Geusebroek
kgeusebroek at xebia.com
Tue Jul 7 03:16:50 EDT 2009
Hi Adrian,
Be careful with this in the Internet Explorer browser since it consumes
a lot of memory this way.
The removed dom elements are not really removed (at least not from
memory) and keep consuming memory until a full page refresh is done.
I have a somewhat workaroundish solution and can provide a patch for you
if you like
Cheers Kris
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Adrian Popa
Sent: Tuesday, July 07, 2009 9:11 AM
To: Roald de Wit
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Forcing a redraw of a Vector Layer
Thank you very much Roald - it did the trick :)
Roald de Wit wrote:
> Hi Adrian,
>
> With the new vector behaviour, layer refreshing is a bit different.
This
> should work for you:
>
> locations.refresh({force: true});
>
> Regards,
>
> Roald
>
> Adrian Popa wrote:
>> Hello everyone,
>>
>> I'm using a Vector layer with a BBOX strategy and gets dynamic data
from
>> a KML file and it works as expected. However, the data I'm displaying
is
>> kind of dynamic (alarms which come and go) and I would like to
>> automatically refresh the layer (without doing a page reload) from
time
>> to time. I've tried using the redraw() function, but it doesn't
refresh
>> the data (since it detects the BBOX hasn't changed).
>>
>> Is there any way to force the layer to re-request the data?
>>
>> Here's my layer definition:
>>
>> locations = new OpenLayers.Layer.Vector("Alarm Locations", {
>> projection: map.displayProjection,
>> minResolution: 1, maxResolution: 38,
>> strategies: [new OpenLayers.Strategy.BBOX()],
>> protocol: new OpenLayers.Protocol.HTTP({ url:
>> "kml_locations.pl", format: new OpenLayers.Format.KML({
extractStyles:
>> true, extractAttributes: true })})});
>> map.addLayer(locations);
>>
>> setTimeout('locations.redraw()', 30000);
>>
>> Regards,
>> Adrian
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>
>
> --
> Roald de Wit
> Software Engineer
> roald.dewit at lisasoft.com
>
> Commercial Support for Open Source GIS Software
> http://lisasoft.com/LISAsoft/SupportedProducts/
>
>
>
> The contents of this email are confidential and may be subject to
> legal or professional privilege and copyright. No representation is
> made that this email is free of viruses or other defects. If you have
> received this communication in error, you may not copy or distribute
> any part of it or otherwise disclose its contents to anyone. Please
> advise the sender of your incorrect receipt of this correspondence.
>
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
More information about the Users
mailing list