fix(geojson): geometry is null

This commit is contained in:
thinkinggis 2019-04-23 10:22:22 +08:00
parent 6d9354d758
commit 44b937fc7d
5 changed files with 7 additions and 4 deletions

View File

@ -11,3 +11,4 @@ demos/*
rollup/* rollup/*
webpack/* webpack/*
src/core/three.js src/core/three.js
testdemo/*

1
.gitignore vendored
View File

@ -75,3 +75,4 @@ demos/image
.vscode .vscode
demos/hexagon.html demos/hexagon.html
demos/model demos/model
testdemo

View File

@ -61,7 +61,7 @@ const scene = new L7.Scene({
window.scene = scene; window.scene = scene;
scene.on('loaded', () => { scene.on('loaded', () => {
var colors = ["#FFF5B8","#FFDC7D","#FFAB5C","#F27049","#D42F31","#730D1C"]; 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() const citylayer = scene.PolygonLayer()
.source(city) .source(city)

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "1.1.9", "version": "1.1.10",
"description": "Large-scale WebGL-powered Geospatial Data Visualization", "description": "Large-scale WebGL-powered Geospatial Data Visualization",
"main": "build/l7.js", "main": "build/l7.js",
"browser": "build/l7.js", "browser": "build/l7.js",

View File

@ -3,6 +3,7 @@ import { getCoords } from '@turf/invariant';
export default function geoJSON(data) { export default function geoJSON(data) {
const resultData = []; const resultData = [];
// 数据为空时处理
turfMeta.flattenEach(data, (currentFeature, featureIndex) => { // 多个polygon 拆成一个 turfMeta.flattenEach(data, (currentFeature, featureIndex) => { // 多个polygon 拆成一个
const coord = getCoords(currentFeature); const coord = getCoords(currentFeature);
const dataItem = { const dataItem = {