Monday 29 April 2019

wms - OpenLayers not refreshing a layer


I have a problem with refreshing layers. I have WMS and WFS layers from one source. I edit WFS and after do wms_layer.redraw(true) but the layer redraws only after zoom in or zoom out.


Same with WFS. I have wfs_layer.visibility=false and do wfs_layer.visibility=true wfs_layer.refresh({force:true}). And layer refreshes only after zoom in or zoom out.


For doing these operations do I have to do something special?



Answer




For redraw WMS layer use redraw method of OpenLayers.Layer.HTTPRequest. For example:


wms_layer.redraw(true);

Refresh method doesn't pass any parameters, so for redraw wfs layer use the following syntax:


wfs_layer.refresh();

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...