[R-sig-Geo] Problem to run a loop
Komine
momadou at yahoo.fr
Tue Aug 9 14:38:41 CEST 2011
Hi,
I have a problem to run a loop to extract pixel values. The name of my
folder is: Image_Band_LST_2010. Names of images: LSR_279; LST_280; LST_281;
etc.
The extension of the image is (.tif)
I use this code:
library(raster)
a <- NULL
Result <- matrix(0,nrow=3,ncol=49)
for(i in 279:327){
a <- raster(paste("C:\\Users\\DISC D\\Image_Band_LST_2010\\LST_",i,sep=""))
Result[1,i-278] <- extract(a, cbind(516689.3630,1689862.3777)) # plot 1
Result[2,i-278] <- extract(a, cbind(452689.3630,1536862.3777)) # plot 2
Result[3,i-278] <- extract(a, cbind(512689.3630,1415862.3777)) # plot 3
}
The result is:
Erreur dans .rasterObjectFromFile(x, band = band, objecttype =
"RasterLayer", :
file: C:\Users\DISC D\Image_Band_LST_2010\LST_279 does not exist
To solve the problem: I indicated the extension of images for instance:
a <- raster(paste("C:\\Users\\DISC
D\\Image_Band_LST_2010\\LST_.tif",i,sep=""))
But the result is always bad.
Can you help me to solve this ptroblem
Komine
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Problem-to-run-a-loop-tp6667926p6667926.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list