wfs openlayers中的featureId过滤

时间:2014-08-24 06:11:02

标签: filtering openlayers geoserver

我想为wfs层定义一个功能Id过滤器,如下所示:

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: ?????
            })

    });

我不知道什么是'键入'过滤选项中的变量?

2 个答案:

答案 0 :(得分:1)

没有'类型'过滤器类型FeatureId上的属性。

API doc

这就够了。

filter:new OpenLayers.Filter.FeatureId({
                fids: ['population.913', 'population.912'];

            });

答案 1 :(得分:1)

问题是设置fids字段。当您将fids设置为['population.913', 'population.912']时,这意味着它的fid等于'population.913''population.912'。如果您将fids字段设置为'population.912''population.913',则会得到正确的回复