我想为wfs层定义一个featureId筛选器,如下所示:
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: ?????
})
});
我不知道在过滤选项中设置"类型"变量是什么?
在过滤器类型FeatureId上没有'type'属性。
API文档
这就够了。
filter:new OpenLayers.Filter.FeatureId({
fids: ['population.913', 'population.912'];
});
问题是设置字段。当您将fids设置为['population.913', 'population.912']
时,这意味着它的fids等于'population.913'
和'population.912'
。如果您将字段设置为'population.912'
或'population.913'
,您将获得正确的响应