gpt4 book ai didi

d3.js - 如何将GIS栅格转换为矢量多边形?

转载 作者:行者123 更新时间:2023-12-02 21:59:23 24 4
gpt4 key购买 nike

如何将栅格 GIS 文件 (tiff) 转换为 .json?

Bostock's example使用过some JSON data喂他D3.geom.contour plugin 。但是如何将 GIS 栅格(比如说一个微小的 11px/15px tiff 图像)转换为 JSON。

最终 .JSON 代码,例如:[编辑:这不是 topojson 格式]

[
[103,104,104,105,105,106,106,106,107,107,106],
[104,104,105,105,106,106,107,107,107,107,107],
[104,105,105,106,106,107,107,108,108,108,108],
[105,105,106,106,107,107,108,108,109,109,109],
[105,106,106,107,107,108,108,109,109,110,110],
[106,106,107,107,107,108,109,109,110,110,111],
[106,107,107,108,108,108,109,110,110,111,112],
[107,107,108,108,109,109,110,110,112,113,114],
[107,108,108,109,109,110,111,112,114,115,116],
[107,108,109,109,110,110,110,113,115,117,118],
[107,108,109,109,110,110,110,112,115,117,119],
[108,108,109,109,110,110,110,112,115,118,121],
[108,109,109,110,110,111,112,114,117,120,124],
[108,109,110,110,110,113,114,116,119,122,126],
[108,109,110,110,112,115,116,118,122,124,128]
]

注意:.shp 到 .json:已经有 a tutorial on how turning shapefiles into lighter topojson ,但在这里没用。

最佳答案

我认为你不能直接做到这一点,这可能需要几个步骤的过程:

流程

转换 .tiff -> .shp

gdal_contour -a elev input.tif output.shp -i 10.0

转换 .shp -> .json (topojson)

topojson input.shp -o output.json 

资源

关于d3.js - 如何将GIS栅格转换为矢量多边形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17207478/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com