[OpenLayers-Users] How to use CQL filter in OpenLayers.Control.WMSGetFeatureInfo?

Asle Benoni asle.benoni at gmail.com
Thu Jun 7 07:48:36 PDT 2012


I have made this map: www.babkart.no

I have a search box that on select of the results sends a refresh of
the layer with CQL parameters to GeoServer. This works.
But of course when I click I get popups of all the markers, even if
they are hidden because I understand that I send a WMS request without
any filter.

So I need help how to use the generated CQL params in my WMS request
for GetFeautureInfo to GeoServer.

My function CQLfilter in app.js on line 1027 produces this link:
prosjektnummer LIKE '%2008-25%' OR prosjektnavn LIKE '%2008-25%
which I use to filter the map.

The question is how I can use this (or IF I can use it!) in my
function (line 907):

info = new OpenLayers.Control.WMSGetFeatureInfo({
                    url: 'http://kart.naturkart.no/geoserver/wms',
                    title: 'Identify features by clicking',
                    queryVisible: true,
                    infoFormat:'application/vnd.ogc.gml',
                    eventListeners: {
                        getfeatureinfo: function(event) {
                            if (popup) {
                                map.removePopup(popup);
                            } ........................

Any ideas on how to use the CQL code here?

~asle


More information about the Users mailing list