Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am developing a web map application by using Geoserver 2.4.0. In my application, I have developed a module like Arcgis Query builder as shown below screenshot.

enter image description here

In that, while I am using CQL Filter, WFS and WMS returns different result for same layer.

var oXml = OpenLayers.Request.GET({
url: "http://xxx.xxx.x.xx:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=Buildings&cql_filter=" + $("#txtBoxQuery").val(),
async: false

var strXml = oXml.responseXML;
var featuresLst = strXml.getElementsByTagName('Buildings');
console.log("Features1: " + featuresLst.length);              //Return Error 

newFilter = format.read($("#txtBoxQuery").val());

var oXml2 = OpenLayers.Request.GET({
url: "http://xxx.xxx.x.xx:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=Buildings&cql_filter=" + newFilter,
async: false

var strXml2 = oXml2.responseXML;
var featuresLst2 = strXml2.getElementsByTagName('Buildings');
console.log("Features2: " + featuresLst2.length);             //Return Error

enter image description here

//tocLayer is Buildings layer

tocLayer.mergeNewParams({ cql_filter: $("#txtBoxQuery").val() });        //Return 1

I am very new to CQL Filter, Kindly help me to fix this issue. Thanks in advance

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.