[OpenLayers-Users] Correct format for cql_filter in WMSgetFeatiureInfo
Asle Benoni
asle.benoni at gmail.com
Tue Jun 12 03:16:54 PDT 2012
Hello,
I am struggling with this code where I have a cql_filter generated from a
search field. If the user has not searched anything the cql_filter must be
empty. I had problems getting a correct syntax if the cql_filter is empty
so I had to set a default value. But when I have a search code for
cql_filter it fails telling me in Firebug:
Layers and filters are mismatched, you need to provide one filter for each layer
My cql_filter code is i.ex. this: "scientificname LIKE '%moser%' ".
I see the cql_filter added to the WMS request but I get the error above.
Any ideas?
if (typeof param != 'undefined') {
var filter_param = param;
} else {var filter_param = 'id > 1'}
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://kart.naturkart.no/geoserver/wms',
title: 'Identify features by clicking',
queryVisible: true,
infoFormat:'application/vnd.ogc.gml',
vendorParams:{
cql_filter: filter_param
},
eventListeners: {
/* 'Beforegetfeatureinfo': function () {
filter_param :filter_param
// this. vendorParams. settings =
Math. random ();
}, */
getfeatureinfo: function(event) {
if (popup) {
map.removePopup(popup);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120612/854ee169/attachment.html>
More information about the Users
mailing list