具有featureType数组的OpenLayers WFS仅显示一个featureType

时间:2011-12-17 23:57:42

标签: gis openlayers

我有2层WFS服务,想要在一个Vector层中显示两个层:

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

配置中缺少什么? 谢谢。

1 个答案:

答案 0 :(得分:1)

我认为你过分指定了网址。我会把它设置为

http://XXX/WFSServer

让OL根据您的参数创建请求。

this example

比较