Write out valid WFS Transaction XML and ability to specify srsName

This commit is contained in:
Bart van den Eijnden
2014-05-21 10:28:32 +02:00
parent 98193c0336
commit 28d122e21e
3 changed files with 74 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Transaction xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Update typeName="foo:FAULTS" xmlns:foo="http://foo">
<Property>
<Name>the_geom</Name>
<Value><MultiLineString xmlns="http://www.opengis.net/gml" srsName="EPSG:900913">
<lineStringMember>
<LineString srsName="EPSG:900913">
<posList>-12279454.47665902 6741885.67968707 -12064207.805007964
6732101.740066567 -11941908.559751684 6595126.585379533
-12240318.718177011 6507071.128795006 -12416429.631346056
6604910.52500003</posList>
</LineString>
</lineStringMember>
</MultiLineString></Value>
</Property>
<Filter xmlns="http://www.opengis.net/ogc">
<FeatureId fid="FAULTS.4455"/>
</Filter>
</Update>
</Transaction>

View File

@@ -222,6 +222,37 @@ describe('ol.format.WFS', function() {
});
});
describe('when writing out a Transaction request', function() {
var text;
before(function(done) {
afterLoadText('spec/ol/format/wfs/TransactionUpdate.xml', function(xml) {
text = xml;
done();
});
});
it('creates the correct update', function() {
var format = new ol.format.WFS();
var updateFeature = new ol.Feature();
updateFeature.setGeometryName('the_geom');
updateFeature.setGeometry(new ol.geom.MultiLineString([[
[-12279454.47665902, 6741885.67968707],
[-12064207.805007964, 6732101.740066567],
[-11941908.559751684, 6595126.585379533],
[-12240318.718177011, 6507071.128795006],
[-12416429.631346056, 6604910.52500003]
]]));
updateFeature.setId('FAULTS.4455');
var serialized = format.writeTransaction(null, [updateFeature], null, {
featureNS: 'http://foo',
featureType: 'FAULTS',
featurePrefix: 'foo',
gmlOptions: {srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(ol.xml.load(text));
});
});
describe('when writing out a Transaction request', function() {
var text;
before(function(done) {