[OpenLayers-Users] Forcing a redraw of a Vector Layer
Adrian Popa
adrian_gh.popa at romtelecom.ro
Tue Jul 7 02:45:24 EDT 2009
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
More information about the Users
mailing list