Merge pull request #2058 from bartvde/wfs-transaction-srs
no way to set srsName on WFS transactions (r=@ahocevar)
This commit is contained in:
+9
-1
@@ -1324,7 +1324,8 @@ olx.format.WFSWriteGetFeatureOptions.prototype.bbox;
|
|||||||
* featureType: string,
|
* featureType: string,
|
||||||
* srsName: (string|undefined),
|
* srsName: (string|undefined),
|
||||||
* handle: (string|undefined),
|
* handle: (string|undefined),
|
||||||
* nativeElements: Array.<Object>}}
|
* nativeElements: Array.<Object>,
|
||||||
|
* gmlOptions: (olx.format.GMLOptions|undefined)}}
|
||||||
* @todo api
|
* @todo api
|
||||||
*/
|
*/
|
||||||
olx.format.WFSWriteTransactionOptions;
|
olx.format.WFSWriteTransactionOptions;
|
||||||
@@ -1373,6 +1374,13 @@ olx.format.WFSWriteTransactionOptions.prototype.handle;
|
|||||||
olx.format.WFSWriteTransactionOptions.prototype.nativeElements;
|
olx.format.WFSWriteTransactionOptions.prototype.nativeElements;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GML options for the WFS transaction writer.
|
||||||
|
* @type {olx.format.GMLOptions|undefined}
|
||||||
|
*/
|
||||||
|
olx.format.WFSWriteTransactionOptions.prototype.gmlOptions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactions for the map. Default is `true` for all options.
|
* Interactions for the map. Default is `true` for all options.
|
||||||
* @typedef {{altShiftDragRotate: (boolean|undefined),
|
* @typedef {{altShiftDragRotate: (boolean|undefined),
|
||||||
|
|||||||
+16
-10
@@ -612,7 +612,9 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
'Transaction');
|
'Transaction');
|
||||||
node.setAttribute('service', 'WFS');
|
node.setAttribute('service', 'WFS');
|
||||||
node.setAttribute('version', '1.1.0');
|
node.setAttribute('version', '1.1.0');
|
||||||
|
var baseObj, obj;
|
||||||
if (goog.isDef(options)) {
|
if (goog.isDef(options)) {
|
||||||
|
baseObj = goog.isDef(options.gmlOptions) ? options.gmlOptions : {};
|
||||||
if (goog.isDef(options.handle)) {
|
if (goog.isDef(options.handle)) {
|
||||||
node.setAttribute('handle', options.handle);
|
node.setAttribute('handle', options.handle);
|
||||||
}
|
}
|
||||||
@@ -620,18 +622,22 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
'xsi:schemaLocation', this.schemaLocation_);
|
'xsi:schemaLocation', this.schemaLocation_);
|
||||||
if (goog.isDefAndNotNull(inserts)) {
|
if (goog.isDefAndNotNull(inserts)) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
obj = {node: node, featureNS: options.featureNS,
|
||||||
featureType: options.featureType},
|
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
goog.object.extend(obj, baseObj);
|
||||||
ol.xml.makeSimpleNodeFactory('Insert'), inserts,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
objectStack);
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
|
ol.xml.makeSimpleNodeFactory('Insert'), inserts,
|
||||||
|
objectStack);
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(updates)) {
|
if (goog.isDefAndNotNull(updates)) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
obj = {node: node, featureNS: options.featureNS,
|
||||||
featureType: options.featureType, featurePrefix: options.featurePrefix},
|
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
goog.object.extend(obj, baseObj);
|
||||||
ol.xml.makeSimpleNodeFactory('Update'), updates,
|
ol.xml.pushSerializeAndPop(obj,
|
||||||
objectStack);
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
|
ol.xml.makeSimpleNodeFactory('Update'), updates,
|
||||||
|
objectStack);
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(deletes)) {
|
if (goog.isDefAndNotNull(deletes)) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<wfs:Transaction xmlns:wfs="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"><wfs:Insert><feature:FAULTS xmlns:feature="http://foo"><feature:the_geom><gml:MultiCurve xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:900913"><gml:curveMember><gml:LineString srsName="EPSG:900913"><gml:posList>-5178372.1885436 1992365.7775042 -4434792.7774889 1601008.1927386 -4043435.1927233 2148908.8114105</gml:posList></gml:LineString></gml:curveMember></gml:MultiCurve></feature:the_geom><feature:TYPE>xyz</feature:TYPE></feature:FAULTS></wfs:Insert></wfs:Transaction>
|
||||||
@@ -192,6 +192,36 @@ describe('ol.format.WFS', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('when writing out a Transaction request', function() {
|
||||||
|
var text;
|
||||||
|
before(function(done) {
|
||||||
|
afterLoadText('spec/ol/format/wfs/TransactionSrs.xml', function(xml) {
|
||||||
|
text = xml;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
it('creates the correct srsName', function() {
|
||||||
|
var format = new ol.format.WFS();
|
||||||
|
var insertFeature = new ol.Feature({
|
||||||
|
the_geom: new ol.geom.MultiLineString([[
|
||||||
|
[-5178372.1885436, 1992365.7775042],
|
||||||
|
[-4434792.7774889, 1601008.1927386],
|
||||||
|
[-4043435.1927233, 2148908.8114105]
|
||||||
|
]]),
|
||||||
|
TYPE: 'xyz'
|
||||||
|
});
|
||||||
|
insertFeature.setGeometryName('the_geom');
|
||||||
|
var inserts = [insertFeature];
|
||||||
|
var serialized = format.writeTransaction(inserts, null, null, {
|
||||||
|
featureNS: 'http://foo',
|
||||||
|
featureType: 'FAULTS',
|
||||||
|
featurePrefix: 'feature',
|
||||||
|
gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'}
|
||||||
|
});
|
||||||
|
expect(serialized).to.xmleql(ol.xml.load(text));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('when writing out a Transaction request', function() {
|
describe('when writing out a Transaction request', function() {
|
||||||
var text;
|
var text;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
@@ -317,6 +347,7 @@ describe('ol.format.WFS', function() {
|
|||||||
|
|
||||||
goog.require('ol.xml');
|
goog.require('ol.xml');
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
|
goog.require('ol.geom.MultiLineString');
|
||||||
goog.require('ol.geom.MultiPoint');
|
goog.require('ol.geom.MultiPoint');
|
||||||
goog.require('ol.geom.MultiPolygon');
|
goog.require('ol.geom.MultiPolygon');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
|
|||||||
Reference in New Issue
Block a user