0

I have a layer with many features and when I add it to a map as WMS layer it works. But if I add the layer as WFS it seems there are no features.

The code I use to load WFS layer is: var layerName = '...'; var workspace = '...'; var vectorLayer = new OpenLayers.Layer.Vector('questolayer', { projection: new OpenLayers.Projection('EPSG:4326'), strategies: [new OpenLayers.Strategy.BBOX()], protocol: new OpenLayers.Protocol.WFS({ version: "1.1.0", url: "/geoserver/wfs", featureType: layerName, featureNS: workspace, srsName: "EPSG:4326" }) }); vectorLayer.events.on({ 'loadend': function(event) { console.warn('00 features: ', vectorLayer.features); } }); openlayersmap.addLayer(vectorLayer);

If I check the response with Firebug I can see an XML with gml:featureMembers tags and many features into of it. But the warn message '00 features' in the log contains an empty vector.

Do you know why?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Feb 16, 2015 at 18:41
0

1 Answer 1

1

I found the issue! It was because the workspace was in uppercase in GeoServer. I convert to lowercase when I set the parameter in the protocol object and now it works. I don't know if this is a bug.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
answered Feb 21, 2015 at 11:05

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.