2

I am in need of the correct syntax for loading WFS layer using OpenLayers. I have gone through many examples on the OpenLayers site and other examples, but can't figure out how to use the necessary and optional options like strategies, protocols etc

James Milner
1,94218 silver badges22 bronze badges
asked May 18, 2012 at 8:36
2
  • 2
    Where do you serve your wfs layer? geoserver, arcgis or sth. it all dependens on serving structure... Commented May 18, 2012 at 8:49
  • 1
    please post the code you have tried so far and what is not working for you Commented May 18, 2012 at 9:43

1 Answer 1

2

Where is somethin like

var wfsLayer = new OpenLayers.Layer.Vector({
 protocol: new OpenLayers.Protocol.WFS({
 url: 'http://example.com/wfs',
 featureType: 'myFeatureTypeName',
 featureNS: 'topp',
 geometryName: 'the_geom'
 }),
 strategies: [ new OpenLayers.Strategy.BBOX() ]
});

getting you? Can you see any GetFeature-Request in Firebug or Inspector? Have you set up your OpenLayers.ProxyHost variable?

answered May 20, 2012 at 0:49
3
  • thank you Crischan, now i have a wfs layer, i have 1 more question. the layer i am retriving has a sld file attached to it. so that, in same wms layer i get a legend. but in wfs layer i don't get legend/ Commented Aug 3, 2012 at 7:38
  • 1
    I don't think there's a legend control for WFS in OpenLayers. WFS+SLD would be WMS (roughly speaking) and for OpenLayers WFS is purely a vector data source with no knowledge about any styles attached to it by your WFS server software. Commented Sep 29, 2012 at 16:33
  • thanks again, i now style the vector layer using openlayers stylemap and use wms layer for legend. Commented Oct 1, 2012 at 7:28

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.