Monday, 12 March 2018

OpenLayers WFS vector layer


I'm trying to add a vector layer with a WFS layer and it's not working. Can anyone point a solution?


OpenLayers code:


var wfs = new OpenLayers.Layer.Vector(
"Stavros Features",
{
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://localhost:8080/geoserver/wfs"
,featureNS : "http://postgis.org"
,featureType: "polygon"
,geometryName: "the_geom"
})
});


In the GeoServer configuration, I have a workspace 'myWorkspace', a store 'myStore' and a layer 'myLayer' and WFS is enabled. Also in the 'publishing' tab of my layer in the 'WMS Settings Default Style' I have selected 'polygon' as myLayer is multipolygon.


What am I doing wrong?


Am I supposed to specify the workspace name in the 'featureNS' property?


Is there a good tutorial for OpenLayers?
I have read the docs which are very poor and the examples doesn't help me always. I have also read the user manual of GeoServer and I found it very good.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...