im4LF
im4LF

Reputation: 325

OpenLayers WFS with array of featureType shows just one featureType

I have WFS service with 2 layers and want to display both layers in one Vector layer:

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 })
    })
});

And OpenLayers show just pref:type1

What am I missing in configuration? Thank you.

Upvotes: 0

Views: 551

Answers (1)

Niklas Wulff
Niklas Wulff

Reputation: 3524

I think you overspecified the url. I would set it to

http://XXX/WFSServer

and let OL create the request based on your parameters.

Compare to this example

Upvotes: 1

Related Questions