我有几个GeoTiff格式的栅格图像图块,我想合并到一个大栅格文件中。 它的工作原理是这样,但是要花很多时间。我可以并行化还是可以用GDAL做到这一点?
rasterlist<- list.files(path = "S2/20180326/ndvi/",pattern = ".tif$",full.names = T)
tiles <- vector(mode = "list", length = length(rasterlist))
for (i in 1:length(rasterlist)) {
temp <- stack(rasterlist[i])
tiles[[i]]<- temp
}
merged_raster <- do.call(merge,tiles)
答案 0 :(得分:0)
您应该可以使用lapply
加快速度,在这种情况下它将替换循环:
rasterlist<- list.files(path = "S2/20180326/ndvi/",pattern = ".tif$",full.names = T)
tiles <- lapply(rasterlist,FUN=stack)
merged_raster <- do.call(merge,tiles)