[GIS] OpenLayers CQL filter gets info about NOT VISIBLE features

cql-filtergetfeatureinfoopenlayers-2querywms

I have a WMS layer and a control WMSGetFeatureInfo.
If I apply a CQL Filter to the layer and I redraw it, the WMSGetFeatureInfo control continue querying also NOT VISIBLE features.
Why in your opinion?
How can I do to fix the problem?

EDIT

info = new OpenLayers.Control.WMSGetFeatureInfo({
 url: 'myserver:8080/geoserver/gis/wms';, 
 title: 'Identify features by clicking', 
 layers: [layer_1,layer_2,layer_3], 
 infoFormat: 'application/vnd.ogc.gml', 
 queryVisible: true
});

info.events.register("getfeatureinfo", this, callFunct);

Best Answer

The WMS GetFeatureInfo request contains everything the server needs to draw your layer so it can work out what you clicked on. If you don't pass it the CQL filter (and I suspect you are not) it can't "know" what is visible on your map.

The solution is to add your filter to the GetFeatureInfo request - I'd offer more help but you didn't post any code.

EDIT Something like this should work:

info = new OpenLayers.Control.WMSGetFeatureInfo({
 url: 'myserver:8080/geoserver/gis/wms';, 
 title: 'Identify features by clicking', 
 layers: [layer_1,layer_2,layer_3], 
 infoFormat: 'application/vnd.ogc.gml', 
 queryVisible: true,
 vendorParams: {'CQL_FILTER' = cql_string} //cql_string is the filter string
});