Gis 带有featureType数组的OpenLayers WFS仅显示一个featureType
我有两个层的WFS服务,希望在一个矢量层中显示两个层:Gis 带有featureType数组的OpenLayers WFS仅显示一个featureType,gis,openlayers,Gis,Openlayers,我有两个层的WFS服务,希望在一个矢量层中显示两个层: var layer = new OpenLayers.Layer.Vector('test', { styleMap: style, strategies: [new OpenLayers.Strategy.BBOX()], projection: new OpenLayers.Projection('EPSG:4326'), protocol: new OpenLayers.Protocol.WFS({
var layer = new OpenLayers.Layer.Vector('test', {
styleMap: style,
strategies: [new OpenLayers.Strategy.BBOX()],
projection: new OpenLayers.Projection('EPSG:4326'),
protocol: new OpenLayers.Protocol.WFS({
version: '1.1.0',
srsName: 'EPSG:4326',
url: 'http://XXX/WFSServer?request=GetFeature&typeName=pref:type1,pref:type2',
featureType: ['type1', 'type2'],
singleFeatureType: false,
featurePrefix: 'pref',
geometryName: 'Shape',
readFormat: new OpenLayers.Format.GML.v3({ xy: false })
})
});
OpenLayers只显示pref:type1
配置中缺少什么?
谢谢。我认为您指定的url太多了。我会把它设定为
http://XXX/WFSServer
让OL根据您的参数创建请求
与相比,我可以验证这是正确的方法。让OpenLayers构建整个请求,否则您将得到不一致的行为。您尝试过我的建议吗?有什么反馈吗?