I created a linestring wfs layer in postgis table and published to geoserver. I am able to display the layer on the openlayers map but while editing the layer getting error:
{http://localhost:8090/geoserver/postgis_24_sample}sampleLine is read-only
below is my code for posting the edit data. Please suggest me how to clear this issue.
var transactWFS = function(mode, f) {
var gml = new ol.format.GML({
featureNS: 'http://localhost:8090/geoserver',
featureType: 'sampleLine',
srsName: 'EPSG:3857'
});
var node;
switch (mode){
case 'insert':
node = formatWFS.writeTransaction([f], null, null, gml);
break;
case 'update':
node = formatWFS.writeTransaction(null, [f], null, gml);
break;
case 'delete':
node = formatWFS.writeTransaction(null, null, [f], gml);
break;
}
var payload = xs.serializeToString(node);
$.ajax('http://localhost:8090/geoserver/postgis_24_sample/wfs', {
type: 'POST',
dataType: 'xml',
processData: false,
contentType: 'text/xml',
data: payload
}).done(function() {
mySampleLineVectorLayer.getSource().clear();
});
}