I'm using Postgis + tomcat + geoserver + openlayers for my application.
With the help of some tutorials, I have reached upto getting feature information of layers.
Next I want to edit and save the editable layers permanently.
I got the below code from the internet:
var editable_layer= new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:4030",
url: "http://127.0.0.1/cgi-bin/tinyows",
featureNS : "http://www.tinyows.org/",
featureType: "frida",
geometryName: "the_geom",
schema: "http://127.0.0.1/cgi-bin/tinyows?service=wfs&request=DescribeFeatureType&version=1.1.0&typename=tows:frida"
})
});
After that I have modified the code like this:
var editable_layer = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
styleMap: mystyle,
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:4030",
url: "http://localhost:8080/geoserver/wfs",
featureNS : "http://localhost:8080",
featureType: "Test:ramcheck", **/*layer name*/**
geometryName: "the_geom",
schema: "http://localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=Test:ramcheck" **/*i don't know how to modify this area*/**
})
});
This code is not working.
I can't see the layer contents on the map.
please help me with a sample code.
Thanks.
Edit
I got some featureNS, feature type and featurePrefix also.
then I changed my code shown below
// create three vector layers
var wfs = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.Fixed(), saveStrategy],
styleMap: sm,
projection: new OpenLayers.Projection("EPSG:4030"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
srsName: "EPSG:4030",
url: "http://localhost:8080/geoserver/wfs",
featurePrefix: "Test", **/*workspace name*/**
featureType: "Test:ramcheck", **/*geoserver layer name*/**
featureNS : "http://localhost:8080/geoserver/test", **/*Workspace Namespace URI*/**
geometryName: "the_geom"
})
});
But, this error is now shown when I try to save the edits in my layer:
"An attempt was made to create or change an object in a way which is incorrect with regard to namespaces".
In openlayers.js below line
return data;},createElementNS:function(uri,name){var element;if(this.xmldom){if(typeof uri=="string"){element=this.xmldom.createNode(1,name,uri);}else{element=this.xmldom.createNode(1,name,"");}}else{element=document.createElementNS(uri,name);}
My geoserver workspace namespace URI is: "http://localhost:8080/geoserver/test". Is there any problem in this name?
Please give your suggestions.