fix(source): geojson parser filter invalid

This commit is contained in:
thinkinggis 2019-04-24 09:44:03 +08:00
parent af7ead3443
commit 2702f028b0
1 changed files with 4 additions and 0 deletions

View File

@ -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);