From 51da7bad8c537a19e4352bc1b310c7458bc9e3aa Mon Sep 17 00:00:00 2001 From: Florent gravin Date: Fri, 3 Oct 2014 16:21:30 +0200 Subject: [PATCH 1/2] Element boundedBy must not be set as geometry field on GML reading --- src/ol/format/gml/gmlbase.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ol/format/gml/gmlbase.js b/src/ol/format/gml/gmlbase.js index b957ed2385..7af2ae39c6 100644 --- a/src/ol/format/gml/gmlbase.js +++ b/src/ol/format/gml/gmlbase.js @@ -170,8 +170,11 @@ ol.format.GMLBase.prototype.readFeature_ = function(node, objectStack) { } values[ol.xml.getLocalName(n)] = value; } else { - geometryName = ol.xml.getLocalName(n); - values[geometryName] = this.readGeometryElement(n, objectStack); + // boundedBy is an extent and must not be considered as a geometry + if (n.localName !== 'boundedBy') { + geometryName = ol.xml.getLocalName(n); + } + values[ol.xml.getLocalName(n)] = this.readGeometryElement(n, objectStack); } } var feature = new ol.Feature(values); From 74410487aa1d3bc2987d86f187bdea877abbb3c6 Mon Sep 17 00:00:00 2001 From: Florent gravin Date: Tue, 28 Oct 2014 16:48:16 +0100 Subject: [PATCH 2/2] Refactor the use of ol.xml.getLocalName(n) --- src/ol/format/gml/gmlbase.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ol/format/gml/gmlbase.js b/src/ol/format/gml/gmlbase.js index 7af2ae39c6..5133badd8c 100644 --- a/src/ol/format/gml/gmlbase.js +++ b/src/ol/format/gml/gmlbase.js @@ -159,6 +159,7 @@ ol.format.GMLBase.prototype.readFeature_ = function(node, objectStack) { var values = {}, geometryName; for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) { + var localName = ol.xml.getLocalName(n); // Assume attribute elements have one child node and that the child // is a text node. Otherwise assume it is a geometry node. if (n.childNodes.length === 0 || @@ -168,13 +169,13 @@ ol.format.GMLBase.prototype.readFeature_ = function(node, objectStack) { if (goog.string.isEmpty(value)) { value = undefined; } - values[ol.xml.getLocalName(n)] = value; + values[localName] = value; } else { // boundedBy is an extent and must not be considered as a geometry - if (n.localName !== 'boundedBy') { - geometryName = ol.xml.getLocalName(n); + if (localName !== 'boundedBy') { + geometryName = localName; } - values[ol.xml.getLocalName(n)] = this.readGeometryElement(n, objectStack); + values[localName] = this.readGeometryElement(n, objectStack); } } var feature = new ol.Feature(values);