我有一个代表地形图的多层 RasterBrick,我想将其以 grd 或 tif 格式保存到硬盘,以便其他人以后可以使用。
这是 RasterBrick:
class : RasterBrick
dimensions : 2400, 4200, 10080000, 3 (nrow, ncol, ncell, nlayers)
resolution : 100, 100 (x, y)
extent : 480000, 9e+05, 62000, 302000 (xmin, xmax, ymin, ymax)
coord. ref. : NA
data source : in memory
names : layer.1, layer.2, layer.3
min values : 2.8725, 2.8725, 2.8725
max values : 254.5175, 254.5175, 254.5175
我尝试使用以下命令保存它:
outfile <- writeRaster(brick, filename='grid.tif', format="GTiff", overwrite=TRUE)
和这个:
outfile <- writeRaster(m, filename='grid.grd', format="raster", overwrite=TRUE)
但是 tif 文件已损坏,并且 grd 对象仅包含一层,当我使用它读回时,它不会被识别为多层 RasterBrickraster()
.
目的是利用地形图作为专题图的背景。