Skip to content

Commit

Permalink
fix(source): geojson parser filter invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Apr 24, 2019
1 parent 1592001 commit d546527
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/source/parser/geojson.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { getCoords } from '@turf/invariant';

export default function geoJSON(data) {
const resultData = [];
data.features = data.features.filter(item => {
return item != null && item.geometry && item.geometry.type && item.geometry.coordinates && item.geometry.coordinates.length > 0;
});

// 数据为空时处理
turfMeta.flattenEach(data, (currentFeature, featureIndex) => { // 多个polygon 拆成一个
const coord = getCoords(currentFeature);
Expand Down

0 comments on commit d546527

Please sign in to comment.