Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using openlayer 2.12 for this wfs filter purpose. I wanted to redraw filter layer as conditions in filter changes dynamic.

Following is my code in for wfs:

 var ty=OpenLayers.Filter.Comparison.EQUAL_TO;
   var propertyOP="name";
    var valOP="buil2";
    build1 = new OpenLayers.Layer.Vector("WFS", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        filter: new OpenLayers.Filter.Comparison({ 
            type: ty,
            property: propertyOP,
                value: ValOP
        protocol: new OpenLayers.Protocol.WFS({
            version: "1.1.0",
            url:  "http://localhost:8080/geoserver/sol/wfs",
            featureType: "ch",
                featureNS: "http://localhost:81/sol"/*,
        projection: geographic,
        styleMap: styleMap

Now i wanted to make this filter to update and show new filter layer result. In my current code previous filter result remain but show result on previous result. My Filter type,property and value get change.

share|improve this question
up vote 1 down vote accepted

I have solved this question and worked in my case:

build1.filter = new OpenLayers.Filter.Comparison({ 
        type: ty,
        property: propertyOP,
            value: ValOP

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.