Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Most tutorials on WFS transaction uses a schema and geom attributes in WFS request like this

var wfs_layer = new OpenLayers.Layer.Vector("Editable Features", {
strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
//projection: new OpenLayers.Projection("EPSG:26910"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "http://localhost/geoserver/wfs",
featureNS :  "http://www.opengeospatial.net/cite",
featureType: "wfst_test",
**geometryName: "the_geom",**
**schema: "http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&;typename=cite:wfst_test"**
})
});

can we omit this or is it compulsory to include them?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Since you are posting a XML document inside insert transactions it should be compulsory to also provide a schema for it. Some servers might accept the transaction even without the schema.

share|improve this answer
    
does geoserver require schema definition? –  neogeomat Aug 18 '12 at 7:59
    
As far as I know it does not, provided you specify the right namespace for the feature you are inserting –  Andrea Aime Aug 19 '12 at 13:50
    
the namespace is correct, the feature id gets inserted but the geometry does not. what might have happened? –  neogeomat Aug 20 '12 at 4:41
    
Often this happens because the geometry is encoded in the wrong version of GML, e.g., GML 2 but you are inserting in a WFS 1.1 transaction that requires GML 3. Another possibility is a geometry type mismatch, you are trying to insert a point in a table that only accepts polygons –  Andrea Aime Aug 20 '12 at 6:06
    
I am using Openlayers.handler.path to draw linear feature, and the geom type of feature is multiline string. i have also cast the line to multiline using this code draw.featureAdded = function(feature) { feature.layer.eraseFeatures([feature]); // cast to multilinestring feature.geometry = new OpenLayers.Geometry.MultiLineString(feature.geometry); //alert(feature.geometry); //feature.style.strokeColor = "#ff0000"; feature.state = OpenLayers.State.INSERT; feature.layer.drawFeature(feature); } –  neogeomat Aug 20 '12 at 6:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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