2

How to turn raster GIS files (tiff) into .json ?

Bostock's example used some JSON data to feed his D3.geom.contour plugin. But how to convert a GIS raster, let's say a tiny 11px/15px tiff image, into a JSON.

Final .JSON code such: [EDIT: this is NOT the topojson format]

[
[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]
]

Note: .shp to .json: There is already a tutorial on how turning shapefiles into lighter topojson, but not useful to here.

4

1 回答 1

5

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

过程

转换.tiff->.shp

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

转换.shp-> .json( topojson )

topojson input.shp -o output.json 

资源

于 2013-06-20T10:10:32.440 回答