如何将栅格GIS文件(tiff)转换为.json?
Bostock's example使用some JSON data来提供他的D3.geom.contour plugin。但是如何将一个GIS栅格,比如一个11px / 15px的小图像转换为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,但对此没有用。
答案 0 :(得分:3)
我认为你不能直接做到这一点,这可能只是一个步骤:
.tiff
- > .shp
gdal_contour -a elev input.tif output.shp -i 10.0
.shp
- > .json
( topojson )topojson input.shp -o output.json
gdal_contour
从栅格高程模型构建矢量轮廓线。