[OpenLayers-Users] OpenLayers Refresh Strategy Problems

Hugh.Barker at csiro.au Hugh.Barker at csiro.au
Mon Oct 3 18:39:38 EDT 2011


I'm developing an application, part of which uses OpenLayers (calling a Geoserver-served WMS) displaying some frequently updated data (a vessel track - or more specifically, a series of points).

I would like to have this vessel track updated at a set interval - OpenLayers.Strategy.Refresh seems like the most appropriate way to do this. I modified the wms.html example (OpenLayers 2.11) slightly to try this, ie:

underway = new OpenLayers.Layer.WMS("Underway Data",
    "http://ubuntu-geospatial-server:8080/geoserver/underway/wms",
    {'layers': 'underway:ss2011_v03', transparent: true, format: 'image/gif'},
    {isBaseLayer: false},
    {strategies : [new OpenLayers.Strategy.Refresh({interval: 6000})]}
);

map.addLayers([layer, underway]);

>From what I can tell, this should work as-is (ie refresh the underway layer every 6 seconds), however nothing happens. The underlying WMS is getting updated - if I refresh the map manually, the updated data will appear.

I've also tried putting the strategy in a separate variable:

refreshStrategy = new OpenLayers.Strategy.Refresh({interval: 2000, force: true});
refreshStrategy.setLayer(underway);
refreshStrategy.activate();

But still nothing happens. I've also tried across browsers, using the trunk version etc.

I'm sure I'm missing something fairly obvious, any help would be much appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111004/b2806f6e/attachment.html


More information about the Users mailing list