Skip to content

Commit

Permalink
Merge branch 'master' into refactor-interactor-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey authored Aug 29, 2016
2 parents 474190e + 0a6efce commit 136e2d5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions src/jsonReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
25 changes: 25 additions & 0 deletions tests/cases/geojsonReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down

0 comments on commit 136e2d5

Please sign in to comment.