From 8328db26d41dd68c56345b2e5a8bc12292dc0b9e Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 9 Dec 2013 16:57:11 +0100 Subject: [PATCH 1/2] Set the srs name when writing GetFeature Also make clear that srsName is only optional for WFS 1.0.0. --- src/objectliterals.jsdoc | 5 +++-- src/ol/parser/ogc/filterparser_v1.js | 2 +- src/ol/parser/ogc/wfsparser_v1.js | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index c2c035b8cb..e9c0fe5c09 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -600,8 +600,9 @@ * @property {string} featureNS The namespace URI used for features. * @property {string} featurePrefix The prefix for the feature namespace. * @property {Array.} featureTypes The feature type names. - * @property {string|undefined} srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. + * @property {string|undefined} srsName SRS name. For WFS 1.1.0, this is + * required. In WFS 1.0.0, no srsName attribute will be set on geometries + * when this is not provided. * @property {string|undefined} handle Handle. * @property {string|undefined} outputFormat Output format. * @property {number} maxFeatures Maximum number of features to fetch. diff --git a/src/ol/parser/ogc/filterparser_v1.js b/src/ol/parser/ogc/filterparser_v1.js index 6a5822ee4f..6f44d61074 100644 --- a/src/ol/parser/ogc/filterparser_v1.js +++ b/src/ol/parser/ogc/filterparser_v1.js @@ -648,6 +648,6 @@ ol.parser.ogc.Filter_v1.prototype.setFeatureType = function(featureType) { ol.parser.ogc.Filter_v1.prototype.setSrsName = function(srsName) { this.srsName = srsName; if (goog.isDefAndNotNull(this.gmlParser_)) { - this.gmlParser_.srsName = this.srsName; + this.gmlParser_.applyWriteOptions({}, {srsName: srsName}); } }; diff --git a/src/ol/parser/ogc/wfsparser_v1.js b/src/ol/parser/ogc/wfsparser_v1.js index 0f188f9074..002fc9a9ab 100644 --- a/src/ol/parser/ogc/wfsparser_v1.js +++ b/src/ol/parser/ogc/wfsparser_v1.js @@ -47,6 +47,9 @@ ol.parser.ogc.WFS_v1 = function(opt_options) { if (goog.isDef(options.maxFeatures)) { node.setAttribute('maxFeatures', options.maxFeatures); } + if (goog.isDef(options.srsName)) { + this.setSrsName(options.srsName); + } } for (var i = 0, ii = options.featureTypes.length; i < ii; i++) { options.featureType = options.featureTypes[i]; From 2fc89b967a0b3667ac3493f6e32b4a9ecc7e5067 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Mon, 9 Dec 2013 17:19:03 +0100 Subject: [PATCH 2/2] Define type for applyWriteOptions call --- src/ol/parser/ogc/filterparser_v1.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ol/parser/ogc/filterparser_v1.js b/src/ol/parser/ogc/filterparser_v1.js index 6f44d61074..3d3ff44d55 100644 --- a/src/ol/parser/ogc/filterparser_v1.js +++ b/src/ol/parser/ogc/filterparser_v1.js @@ -648,6 +648,7 @@ ol.parser.ogc.Filter_v1.prototype.setFeatureType = function(featureType) { ol.parser.ogc.Filter_v1.prototype.setSrsName = function(srsName) { this.srsName = srsName; if (goog.isDefAndNotNull(this.gmlParser_)) { - this.gmlParser_.applyWriteOptions({}, {srsName: srsName}); + this.gmlParser_.applyWriteOptions({}, + /** @type {ol.parser.GMLWriteOptions} */ ({srsName: srsName})); } };