From fc384aa28b14dee3cf12a62633b4f585dbb65e0e Mon Sep 17 00:00:00 2001 From: David Manthey Date: Fri, 26 Aug 2016 13:30:34 -0400 Subject: [PATCH 1/2] Upgrade to vgl 0.3.9. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cd7090c1f9..659848ec59 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "sinon": "1.17.3", "style-loader": "^0.13.1", "url-loader": "^0.5.7", - "vgl": "0.3.8", + "vgl": "0.3.9", "webpack": "^1.12.14", "webpack-dev-server": "^1.14.1", "xmlbuilder": "^8.2.2" From 8f9a06e195384ed02b8d2aa7782f3904998ca0ca Mon Sep 17 00:00:00 2001 From: Jonathan Beezley Date: Fri, 26 Aug 2016 13:33:19 -0400 Subject: [PATCH 2/2] Ignore features with empty geometries --- src/jsonReader.js | 7 +++++++ tests/cases/geojsonReader.js | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/jsonReader.js b/src/jsonReader.js index ed93c5029b..c7aa3dad3e 100644 --- a/src/jsonReader.js +++ b/src/jsonReader.js @@ -133,6 +133,13 @@ var jsonReader = function (arg) { features.forEach(function (feature) { Array.prototype.push.apply(normalized, m_this._feature(feature)); }); + + // remove features with empty geometries + normalized = normalized.filter(function (feature) { + return feature.geometry && + feature.geometry.coordinates && + feature.geometry.coordinates.length; + }); return normalized; }; diff --git a/tests/cases/geojsonReader.js b/tests/cases/geojsonReader.js index ca00171eef..dd4829da77 100644 --- a/tests/cases/geojsonReader.js +++ b/tests/cases/geojsonReader.js @@ -213,6 +213,31 @@ describe('geojsonReader', function () { coordinates: [1, 1] } }]); + + it('empty geometry', function () { + expect(reader._featureArray({ + type: 'FeatureCollection', + features: [{ + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [] + } + }, { + type: 'Feature', + geometry: { + type: 'LineString', + coordinates: [] + } + }, { + type: 'Feature', + geometry: { + type: 'Polygon', + coordinates: [] + } + }] + })).toEqual([]); + }); }); describe('Errors', function () {