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

Hug*_*lpz 2 gis maps gdal d3.js topojson

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

Bostock 的示例使用了一些 JSON 数据来提供他的D3.geom.contour 插件。但是如何将 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]
]
Run Code Online (Sandbox Code Playgroud)

注意:.shp 到 .json:已经有一个关于如何将 shapefile 转换为更轻的 topojson 的教程,但对这里没有用。

Édo*_*pez 5

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

过程

转换.tiff->.shp

gdal_contour -a elev input.tif output.shp -i 10.0
Run Code Online (Sandbox Code Playgroud)

转换.shp-> .json( topojson )

topojson input.shp -o output.json 
Run Code Online (Sandbox Code Playgroud)

资源