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
-
2Where do you serve your wfs layer? geoserver, arcgis or sth. it all dependens on serving structure...urcm– urcm2012年05月18日 08:49:24 +00:00Commented May 18, 2012 at 8:49
-
1please post the code you have tried so far and what is not working for youIan Turton– Ian Turton2012年05月18日 09:43:39 +00:00Commented May 18, 2012 at 9:43
1 Answer 1
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
-
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– neogeomat2012年08月03日 07:38:59 +00:00Commented Aug 3, 2012 at 7:38
-
1I 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– Crischan2012年09月29日 16:33:54 +00:00Commented Sep 29, 2012 at 16:33
-
thanks again, i now style the vector layer using openlayers stylemap and use wms layer for legend.neogeomat– neogeomat2012年10月01日 07:28:10 +00:00Commented Oct 1, 2012 at 7:28
lang-js