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

7eumitmz  于 2022-11-12  发布在  其他
关注(0)|答案(1)|浏览(166)

如何将栅格GIS文件(tiff)转换为.json?
Bostock's example使用some JSON dataD3.geom.contour plugin提供数据。但是如何将GIS栅格(比如一个11 px/15 px的小tiff图像)转换为JSON。
final.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:已经有一个教程是关于如何将shapefile变成更轻的topojson的,但对这里没有用。

cngwdvgl

cngwdvgl1#

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

流程

转换.tiff-〉.shp

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

转换.shp-〉.json(* 拓扑 *)

topojson input.shp -o output.json

资源

相关问题