小编Daa*_*aan的帖子

d3.geoPath() 返回错误:<path> 属性 d:预期数字,“M,ZM,ZM,ZM,Z”

编辑:在 jsfiddle https://jsfiddle.net/exLtcgrq/1/上重新创建逻辑

我正在尝试使用 D3 V4 API 将一个简单的 GeoJSON 文件解析为 D3。

我的 GeoJSON 很简单:

{ "type": "FeatureCollection",
  "features": [
    { "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [10.0, 10.0], [60.0, 40.0], [50.0, 75.0],[20.0, 60.0]
        ]
      },
      "properties": {
        "id": "1",
        "Type": "campingspot"
      }
    },
    { "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [20.0, 65.0], [50.0, 80.0], [50.0, 110.0],[20.0, 115.0]
        ]
      },
      "properties": {
        "id": "1",
        "Type": "campingspot"
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

我因此使用 d3.json() 方法加载并尝试使用 d3-geo api 将其转换为具有以下代码的路径: …

geojson d3.js

2
推荐指数
1
解决办法
704
查看次数

标签 统计

d3.js ×1

geojson ×1