[OpenLayers-Users] Forcing a redraw of a Vector Layer

Adrian Popa adrian_gh.popa at romtelecom.ro
Tue Jul 7 03:10:34 EDT 2009


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.
>





More information about the Users mailing list