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 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({
            srsName:"EPSG:4326",
            version: "1.1.0",
            url:  "http://localhost:8080/geoserver/sol/wfs",
            featureType: "ch",
            featurePrefix:"sol",
                featureNS: "http://localhost:81/sol"/*,
            geometryName:"geom"*/
        }),
        projection: geographic,
        styleMap: styleMap
        });
    map.addLayer(build1);

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

1 Answer 1

up vote 0 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
    });

build1.refresh({force:true}); 
share|improve this answer

Your Answer

 
discard

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.