writeRaster output file size

馋奶兔 提交于 2019-12-06 00:40:38

You can set the default datatype for writing rasters with the rasterOptions() as follows:

rasterOptions(datatype="INT2U")

Or directly in the writeRaster call:

writeRaster(yourRas, "path/to/raster/", dataType="INT2U", options="COMPRESS=LZW")

Also notice the options argument where you can specify compression.

Usually when I export integer rasters from R, I make sure that I really have integers and not floats, since this can result in an empty raster. Try the following before exporting:

ras <- as.integer(ras)

Please note: Also check for negative values in your raster. Try INT2S if you have values below zero.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!