Question

I use WMS layer in my application and I need to refresh it with new parameters.

I did refresh the WMS layer correctly but I couldn't find a way to refresh its select control. So I got the new layer but cannot click on any point to display its info. Here is a piece of my code:

Layer =new OpenLayers.Layer.WMS(
            "test",
            "http://IP/geoserver/wms",

            {
                layers: "test:testLayer" ,       
                transparent: "true",
                format: "image/png",
                sld_body: sld
            },{visibility: true},
            {isBaseLayer: false}
        );
Layer.addOptions({id:'Layer'});
 map.addLayer(Layer);
Layer.mergeNewParams( { viewparams: 'UID:2' });

 var selectControl = new OpenLayers.Control.GetFeature({
        protocol: OpenLayers.Protocol.WFS.fromWMSLayer(Layer, {
           url: "http://IP/geoserver/wfs",
          featureType: "testLayer"
        }),
        hover: true
    }); 
map.addControl(selectControl);
selectControl.activate();
Was it helpful?

Solution

try adding selectControl.refresh();

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top