gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 05:00:20 26 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/

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