Search code examples
filteringopenlayersgeoserver

featureId filtering in wfs openlayers


I want to define a featureId fiter for wfs layer like below:

wfs = new OpenLayers.Layer.Vector("WFS Vectore", {
        strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
        projection: new OpenLayers.Projection("EPSG:4326"),
        protocol: new OpenLayers.Protocol.WFS({
            version: "1.1.0",
            srsName: "EPSG:4326",
            url: "http://localhost:8080/geoserver/iran/wms?service=WFS",
            featureType: "population",
            featureNS: "http://iran.kadaster.org",
            geometryName: "the_geom"
        }),
        filter:
            new OpenLayers.Filter.FeatureId({
                fids: ['population.913', 'population.912']
                //type: ?????
            })

    });

I don't know to what set 'type' variable in filtering option?


Solution

  • The problem was set fids field. When you set fids to ['population.913', 'population.912'], this means a feature that it's fids equal to 'population.913' and 'population.912'. If you set fids field to 'population.912' or 'population.913' you get correct response