您当前的位置: 首页 >  ar

漏刻有时

暂无认证

  • 1浏览

    0关注

    717博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Eccharts加载geojson环形GeometryCollection格式的解决方案:Cannot read property ‘length‘ of undefined

漏刻有时 发布时间:2021-08-25 18:17:51 ,浏览量:1

当echarts加载通过mapshaper合并后的geojson格式,会出现错误提示:Uncaught TypeError: Cannot read property 'length' of undefined

项目需求
  1. 在阿里Datav下载标准的geojson格式数据后,发现部分区域本身是一个整体,出现环形区域,通过分割线将其划成多个部分,影响地图的可视化效果。 在这里插入图片描述
  2. 通过mapshaper合并后的数据格式为环形格式GeometryCollection,该格式无法正常加载 在这里插入图片描述
解决方案

手动调整格式,标准格式如下: 在这里插入图片描述

环形区域geojson格式
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "name": "河口区"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [],
          []
        ]
      }
    }
  ]
}
Echarts加载效果

在这里插入图片描述

将coordinates对应的内部数组,替换环形数据即可。 lockdatav Done!

关注
打赏
1661217259
查看更多评论
立即登录/注册

微信扫码登录

0.0377s