<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML - wst\0119pnie sformatowany Znak";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.objectbox
        {mso-style-name:objectbox;}
span.errormessage
        {mso-style-name:errormessage;}
span.HTML-wstpniesformatowanyZnak
        {mso-style-name:"HTML - wst\0119pnie sformatowany Znak";
        mso-style-priority:99;
        mso-style-link:"HTML - wst\0119pnie sformatowany";
        font-family:Consolas;
        mso-fareast-language:PL;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.Stylwiadomocie-mail23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=PL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Geoserver uses cql_filter as far as I remember. Try replacing filter_param with cql_filter and you should be ok<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> openlayers-users-bounces@lists.osgeo.org [mailto:openlayers-users-bounces@lists.osgeo.org] <b>On Behalf Of </b>Asle Benoni<br><b>Sent:</b> Saturday, June 09, 2012 1:13 PM<br><b>To:</b> Ignacio Talavera<br><b>Cc:</b> openlayers-users@lists.osgeo.org<br><b>Subject:</b> Re: [OpenLayers-Users] How to use CQL filter in OpenLayers.Control.WMSGetFeatureInfo?<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thank you for putting me in this direction.<br>I get an error with your suggested code. <span class=objectbox><o:p></o:p></span></p><div><p class=MsoNormal><span class=errormessage>missing ; before statement</span><o:p></o:p></p></div><div><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr><td style='padding:0cm 0cm 0cm 0cm'></td><td style='padding:0cm 0cm 0cm 0cm'><pre>var filter_param["cql_filter"] = "norsknavngruppe LIKE '%Sopp%';<o:p></o:p></pre><pre><span class=apple-style-span><span style='font-family:"Arial","sans-serif"'>So I tried this:</span></span><o:p></o:p></pre></td></tr></table></div><div><p class=MsoNormal><br>          <b>var filter_param = "norsknavngruppe LIKE '%Sopp%'";</b><br>                   info = new OpenLayers.Control.WMSGetFeatureInfo({<br>                   url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>                   title: 'Identify features by clicking',<br>                   queryVisible: true,<br>                   infoFormat:'application/vnd.ogc.gml',<br>                   <b>vendorParams:{<br>                   filter_param:filter_param<br>                   },</b><br>                   eventListeners: {<br>                       getfeatureinfo: function(event) {<br>                           if (popup) {<br>                               map.removePopup(popup);<br>                           } .........<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I get no error and I see (in Firebug) that this is added to the WMS request:<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><code><span style='font-size:10.0pt'>&info_format=application%2Fvnd.ogc.gml&filter_param=norsknavngruppe%20LIKE%20'%25Sopp%25'</span></code><o:p></o:p></p></div><div><p class=MsoNormal>Still I get no filtering of the popups and it shows any data that is in the clicked location. I see that the response contains i.ex.<o:p></o:p></p></div><div><p class=MsoNormal><gbif_ns:norsknavngruppe>Lav</gbif_ns:norsknavngruppe><o:p></o:p></p></div><div><p class=MsoNormal>and it should not be included since I only want "norsknavngruppe LIKE '%Sopp%". <o:p></o:p></p></div><div><p class=MsoNormal>Is there something wrong with my code? Thanks for any suggestions!<o:p></o:p></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>2012/6/8 Ignacio Talavera <<a href="mailto:ignacio.talavera@gmail.com">ignacio.talavera@gmail.com</a>>:<br>> Hi the WMSGetFeatureInfo manage additionals parameters of the url of the<br>> GetFeatureInfo Request in  vendorparams attribute.<br>> So try to add this to your code<br>><br>> var filter_param["cql_filter"] = prosjektnummer LIKE '%2008-25%' OR<br>> prosjektnavn LIKE '%2008-25%<br>> info = new OpenLayers.Control.WMSGetFeatureInfo({<br>>                    url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>>                    title: 'Identify features by clicking',<br>>                    queryVisible: true,<br>>                    infoFormat:'application/vnd.ogc.gml',<br>>                    vendorParams:filter_param<br>> eventListeners: {<br>>                        getfeatureinfo: function(event) {<br>>                            if (popup) {<br>>                                map.removePopup(popup);<br>>                            } ........................<br>> I hope this is useful to you.<br>> Regards<br>> Nacho<br>> On Thu, Jun 7, 2012 at 11:48 AM, Asle Benoni <<a href="mailto:asle.benoni@gmail.com">asle.benoni@gmail.com</a>> wrote:<br>>><br>>> I have made this map: <a href="http://www.babkart.no">www.babkart.no</a><br>>><br>>> I have a search box that on select of the results sends a refresh of<br>>> the layer with CQL parameters to GeoServer. This works.<br>>> But of course when I click I get popups of all the markers, even if<br>>> they are hidden because I understand that I send a WMS request without<br>>> any filter.<br>>><br>>> So I need help how to use the generated CQL params in my WMS request<br>>> for GetFeautureInfo to GeoServer.<br>>><br>>> My function CQLfilter in app.js on line 1027 produces this link:<br>>> prosjektnummer LIKE '%2008-25%' OR prosjektnavn LIKE '%2008-25%<br>>> which I use to filter the map.<br>>><br>>> The question is how I can use this (or IF I can use it!) in my<br>>> function (line 907):<br>>><br>>> info = new OpenLayers.Control.WMSGetFeatureInfo({<br>>>                    url: '<a href="http://kart.naturkart.no/geoserver/wms">http://kart.naturkart.no/geoserver/wms</a>',<br>>>                    title: 'Identify features by clicking',<br>>>                    queryVisible: true,<br>>>                    infoFormat:'application/vnd.ogc.gml',<br>>>                    eventListeners: {<br>>>                        getfeatureinfo: function(event) {<br>>>                            if (popup) {<br>>>                                map.removePopup(popup);<br>>>                            } ........................<br>>><br>>> Any ideas on how to use the CQL code here?<br>>><br>>> ~asle<br>>> _______________________________________________<br>>> Users mailing list<br>>> <a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>>> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>><br>><o:p></o:p></p></div></div></div></body></html>