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.
Problem to run a loop
5 messages · Komine, Tobias Vetter, Ahmadou Dicko
Try "/" instead of "\": C:/Users/DISC D/Image_Band_LST_2010/ Tobias
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.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Sorry, but forget what I wrote before. Tobias
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.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110809/81b3c2d9/attachment.pl>
Thank you very much for your help. I solved the problem about the loop with indications of Cheers florian. However, before results were showed, I had 49 rows ( equal to the number of files) indicating: Fixing "AREA_OR_POINT=Point" georeference What this file mean? Thank you in advance Komine -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Problem-to-run-a-loop-tp6667926p6668392.html Sent from the R-sig-geo mailing list archive at Nabble.com.