I am using the WMSGetFeatureInfo and I am also obtaining the Info of the base raster and i do not need that. Is it possible to obtain the FeatureInfo of only selected WMS features?
How can I modify this code to accommodate only selected WMS layer?
info = new OpenLayers.Control.WMSGetFeatureInfo({
url : 'http://niles.iplantcollaborative.org:8080/geoserver/wms',
title : 'Identify features by clicking',
queryVisible : true,
eventListeners : {
getfeatureinfo : function(event) {
map.addPopup(new OpenLayers.Popup.FramedCloud("chicken", map.getLonLatFromPixel(event.xy), null, event.text, null, true));
}
}
});
map.addControl(info);
info.activate();
UPDATE 2.0
I have added the code,
gfLayers = [];
var lyr = map.layers;
for(var a=0; a < lyr.length; a++){
if(lyr[a].CLASS_NAME == "OpenLayers.Layer.WMS" && lyr[a].visibility == true){
if(lyr[a].isBaseLayer == false){
gfLayers.push(lyr[a].name);
}
}
};
info = {
hover : new OpenLayers.Control.WMSGetFeatureInfo({
url : 'http://niles.iplantcollaborative.org:8080/geoserver/wms',
title : 'Identify features by clicking',
//layers : gfLayers,
layers : [pima, carib],
queryVisible : true,
hover: true,
eventListeners : {
getfeatureinfo : function(event) {
deletePopUp();
popup = new OpenLayers.Popup.FramedCloud("popInfo", map.getLonLatFromPixel(event.xy), null, event.text, null, true);
map.addPopup(popup);
}
}
})
};
map.addControl(info.hover);
info.hover.activate();
Now I am getting Empty PopUps. not sure why?