How to select multiple WMS layers?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to select multiple WMS layers?

ashukla
This post has NOT been accepted by the mailing list yet.
Hi All,

I'm using Geoserver V2.1.3 and Openlayers V2.12. In my application I've added layers as wms because wfs layers are very heavy,takes too much time to load and sometimes browser crashes. To select and get records of selected features I'm using  ''new OpenLayers.Control.GetFeature'' function. GetFeature method only select features of top layer on map but the application requires to select multiple layer selection.

The SLDSelect method only select/highlight features on map but doesn't return attribute data.

Does someone has any idea regarding same? Any help or suggestion will be highly appreciated.

Below is code snippet:

 control[i] = new OpenLayers.Control.GetFeature({
                    protocol:OpenLayers.Protocol.WFS.fromWMSLayer(map.layers[i]),
                    box:true,
                    version:"1.1.0",
                    multiple:true,
                    toggleKey:"ctrlKey"
                }
            );

 control[i].events.register("featureselected", this, function (e) {
                if (elements[e.feature.attributes['FEATURE_CODE']] == null)
                    elements[e.feature.attributes['FEATURE_CODE']] = e.feature.attributes['KOPPEL_ID'];
                else
                    elements[e.feature.attributes['FEATURE_CODE']] = elements[e.feature.attributes['FEATURE_CODE']] + ',' + e.feature.attributes['KOPPEL_ID'];
                map.getLayersByName("Selection")[0].addFeatures([e.feature]);
                if (elements)
                    Ext.getCmp("btnAttributeInfo").enable();
            });
            control[i].events.register("featureunselected", this, function (e) {
                elements = {};
                map.getLayersByName("Selection")[0].removeFeatures([e.feature]);
                Ext.getCmp("btnAttributeInfo").disable();
            });
            map.addControl(control[i]);
            control[i].activate();



Thanks,
Ashukla