0

运行堆叠栅格列表时如何解决此问题?这是我运行的程序,

library(raster)
setwd("E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1.tar")
raslist <- paste0('E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B', 1:11, ".tif")
raslist
landsat8 <- stack(raslist)

它返回

library(raster)
setwd("E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1.tar") raslist <- paste0('E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B', 1:11, ".tif") 
 raslist [1] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B1.tif"
[2] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B2.tif" 
[3] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B3.tif" 
[4] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B4.tif" 
[5] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B5.tif" 
[6] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B6.tif" 
[7] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B7.tif" 
[8] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B8.tif" 
[9] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B9.tif" 
[10] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B10.tif" 
[11] "E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1_B11.tif"
 


landsat
8 <- stack(raslist)
Error in .local(.Object, ...) :  Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer",  :    
    Cannot create a RasterLayer object from this file. (file does not exist)
4

1 回答 1

1

你可以看到哪个文件不存在

file.exists(raslist)

你也可以试试这样的

library(raster)
setwd("E:\\Gis-shp\\Chaurjahari\\LC08_L1TP_143040_20191016_20191029_01_T1.tar")
raslist <- list.files(pattern="LC08_L1TP_143040_20191016_20191029_01_T1_B.*tif$")
landsat8 <- stack(raslist)
于 2020-09-24T09:43:52.847 回答