Updating the WFS (transaction) format to add srsName to geometry and include attributes. Thanks sbenthall for the patch. r=me (closes #1344)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6150 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-02-08 23:54:24 +00:00
parent f27833f1db
commit de13a7f91f

View File

@@ -22,6 +22,9 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, {
*/ */
wfsns: "http://www.opengis.net/wfs", wfsns: "http://www.opengis.net/wfs",
/**
* Property: ogcns
*/
ogcns: "http://www.opengis.net/ogc", ogcns: "http://www.opengis.net/ogc",
/* /*
@@ -138,11 +141,33 @@ OpenLayers.Format.WFS = OpenLayers.Class(OpenLayers.Format.GML, {
propertyNode.appendChild(nameNode); propertyNode.appendChild(nameNode);
var valueNode = this.createElementNS(this.wfsns, 'wfs:Value'); var valueNode = this.createElementNS(this.wfsns, 'wfs:Value');
valueNode.appendChild(this.buildGeometryNode(feature.geometry));
var geometryNode = this.buildGeometryNode(feature.geometry);
if(feature.layer){
geometryNode.setAttribute(
"srsName", feature.layer.projection.getCode()
);
}
valueNode.appendChild(geometryNode);
propertyNode.appendChild(valueNode); propertyNode.appendChild(valueNode);
updateNode.appendChild(propertyNode); updateNode.appendChild(propertyNode);
// add in attributes
for(var propName in feature.attributes) {
propertyNode = this.createElementNS(this.wfsns, 'wfs:Property');
nameNode = this.createElementNS(this.wfsns, 'wfs:Name');
nameNode.appendChild(this.createTextNode(propName));
propertyNode.appendChild(nameNode);
valueNode = this.createElementNS(this.wfsns, 'wfs:Value');
valueNode.appendChild(this.createTextNode(feature.attributes[propName]));
propertyNode.appendChild(valueNode);
updateNode.appendChild(propertyNode);
}
var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter'); var filterNode = this.createElementNS(this.ogcns, 'ogc:Filter');
var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId'); var filterIdNode = this.createElementNS(this.ogcns, 'ogc:FeatureId');
filterIdNode.setAttribute("fid", feature.fid); filterIdNode.setAttribute("fid", feature.fid);