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

2
  • 2
    Where do you serve your wfs layer? geoserver, arcgis or sth. it all dependens on serving structure...
    – Aragon
    May 18 '12 at 8:49
  • 1
    please post the code you have tried so far and what is not working for you
    – Ian Turton
    May 18 '12 at 9:43
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?

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/
    – neogeomat
    Aug 3 '12 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.
    – Crischan
    Sep 29 '12 at 16:33
  • thanks again, i now style the vector layer using openlayers stylemap and use wms layer for legend.
    – neogeomat
    Oct 1 '12 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.