Tuesday, 1 January 2019

wms - OpenLayers CQL filter gets info about NOT VISIBLE features


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);

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
});

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...