diff --git a/src/ol/parser/ogc/gmlparser.js b/src/ol/parser/ogc/gmlparser.js index 088cfe13ac..6431298975 100644 --- a/src/ol/parser/ogc/gmlparser.js +++ b/src/ol/parser/ogc/gmlparser.js @@ -148,6 +148,9 @@ ol.parser.ogc.GML = function(opt_options) { 'polygonMember': function(node, obj) { this.readChildNodes(node, obj); }, + 'boundedBy': function(node, obj) { + this.readChildNodes(node, obj); + }, 'Point': function(node, container) { var coordinates = []; this.readers[this.defaultNamespaceURI]['_inherit'].apply(this, diff --git a/src/ol/parser/ogc/wfsparser_v1_1_0.js b/src/ol/parser/ogc/wfsparser_v1_1_0.js index 016fd10a7d..e788cd4b5b 100644 --- a/src/ol/parser/ogc/wfsparser_v1_1_0.js +++ b/src/ol/parser/ogc/wfsparser_v1_1_0.js @@ -9,18 +9,22 @@ goog.require('ol.parser.ogc.WFS_v1'); /** * @constructor +* @param {ol.parser.WFSOptions=} opt_options + * Optional configuration object. * @extends {ol.parser.ogc.WFS_v1} */ -ol.parser.ogc.WFS_v1_1_0 = function() { - goog.base(this); +ol.parser.ogc.WFS_v1_1_0 = function(opt_options) { + goog.base(this, opt_options); this.version = '1.1.0'; this.schemaLocation = this.defaultNamespaceURI + ' ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'; goog.object.extend(this.readers[this.defaultNamespaceURI], { 'FeatureCollection': goog.functions.sequence( function(node, obj) { - obj.numberOfFeatures = parseInt( - node.getAttribute('numberOfFeatures'), 10); + var numberOfFeatures = node.getAttribute('numberOfFeatures'); + if (!goog.isNull(numberOfFeatures)) { + obj.numberOfFeatures = parseInt(numberOfFeatures, 10); + } }, this.readers['http://www.opengis.net/wfs']['FeatureCollection'] ), diff --git a/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js b/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js index 2af072d81a..5027f1d4f6 100644 --- a/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js +++ b/test/spec/ol/parser/ogc/wfs_v1_1_0.test.js @@ -29,6 +29,21 @@ describe('ol.parser.ogc.WFS_v1_1_0', function() { done(); }); }); + + it('handles read of boundedBy on the FeatureCollection', function(done) { + var url = 'spec/ol/parser/ogc/xml/wfs_v1_1_0/boundedBy.xml'; + afterLoadXml(url, function(xml) { + // the XML does not contain a version attribute on the root node + var p = new ol.parser.ogc.WFS_v1_1_0(); + var obj = p.read(xml); + expect(obj.bounds[0]).to.equal(3197.88); + expect(obj.bounds[1]).to.equal(306457.313); + expect(obj.bounds[2]).to.equal(280339.156); + expect(obj.bounds[3]).to.equal(613850.438); + done(); + }); + }); + }); }); diff --git a/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/boundedBy.xml b/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/boundedBy.xml new file mode 100644 index 0000000000..4daeb2eadc --- /dev/null +++ b/test/spec/ol/parser/ogc/xml/wfs_v1_1_0/boundedBy.xml @@ -0,0 +1,47 @@ + + + + 3197.880000 306457.313000 + 280339.156000 613850.438000 + + + + + + + + 196507.469000 502347.938000 + 202430.844000 510383.719000 + + + + + + + + + + 200448.047000 510383.719000 198475.031000 509253.875000 198477.422000 507339.688000 196507.469000 505841.969000 196507.625000 504980.281000 196621.359000 505029.969000 196825.328000 505114.000000 197310.031000 505183.469000 197636.609000 505148.750000 197837.594000 505061.563000 197941.031000 504953.688000 198003.094000 504817.719000 198023.781000 504721.688000 198016.391000 504597.531000 197907.234000 504363.219000 197716.734000 504013.969000 197700.156000 503567.563000 197775.531000 503373.969000 197930.688000 503153.781000 198034.234000 503045.594000 198170.078000 502932.125000 198504.047000 502725.250000 198858.719000 502550.875000 199138.000000 502460.719000 199336.000000 502347.938000 199044.125000 504910.969000 199549.359000 507065.781000 200280.594000 506878.938000 202430.844000 507474.625000 202430.844000 508850.906000 200448.047000 510383.719000 + + + + + + + + 791 + 1800.89 + 4620 + + + 0 + 24305.1 + + +