From 9d8bfb159a3b3076edb7220858d2e9dd2857f4a4 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Tue, 23 Apr 2019 10:22:22 +0800 Subject: [PATCH] fix(geojson): geometry is null --- .eslintignore | 3 ++- .gitignore | 3 ++- demos/04_choropleths_polygon.html | 2 +- package.json | 2 +- src/source/parser/geojson.js | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.eslintignore b/.eslintignore index 9e34b3efdb..8dcfb7d80d 100755 --- a/.eslintignore +++ b/.eslintignore @@ -10,4 +10,5 @@ demos/index.html demos/* rollup/* webpack/* -src/core/three.js \ No newline at end of file +src/core/three.js +testdemo/* \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5fb73328f2..bb2eaa557b 100755 --- a/.gitignore +++ b/.gitignore @@ -74,4 +74,5 @@ demos/data demos/image .vscode demos/hexagon.html -demos/model \ No newline at end of file +demos/model +testdemo \ No newline at end of file diff --git a/demos/04_choropleths_polygon.html b/demos/04_choropleths_polygon.html index c1059cc1ce..f0b263abba 100644 --- a/demos/04_choropleths_polygon.html +++ b/demos/04_choropleths_polygon.html @@ -61,7 +61,7 @@ const scene = new L7.Scene({ window.scene = scene; scene.on('loaded', () => { var colors = ["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"]; - $.getJSON('https://gw.alipayobjects.com/os/basement_prod/7224a078-e3a3-4cc3-8749-7026af9e5c7f.json', city => { + $.getJSON('https://gw.alipayobjects.com/os/basement_prod/77497aa8-8dd0-4a0c-bf3b-3bb55c5d453c.json', city => { const citylayer = scene.PolygonLayer() .source(city) diff --git a/package.json b/package.json index 529672e824..dcca835f42 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "1.1.9", + "version": "1.1.10", "description": "Large-scale WebGL-powered Geospatial Data Visualization", "main": "build/l7.js", "browser": "build/l7.js", diff --git a/src/source/parser/geojson.js b/src/source/parser/geojson.js index d157b4ffec..791dd2de0d 100644 --- a/src/source/parser/geojson.js +++ b/src/source/parser/geojson.js @@ -3,6 +3,7 @@ import { getCoords } from '@turf/invariant'; export default function geoJSON(data) { const resultData = []; + // 数据为空时处理 turfMeta.flattenEach(data, (currentFeature, featureIndex) => { // 多个polygon 拆成一个 const coord = getCoords(currentFeature); const dataItem = {