Skip to content
Prev 25028 / 29559 Next

apply() proj4string to list of rasters

On 11/1/2016 1:39 PM, Roger Bivand wrote:
The function that worked for me is:

filenames <- list.files(pattern="ht.laz.bil")   #Extract list of file 
names from working directory
library(raster) #Calls 'raster' library
#Function 'f1' imports data listed in 'filenames' and assigns projection
f1<-function(x,z) {
         y <- raster(x)
         projection(y) <- CRS(z)
         return(y)
}

It uses your suggestion and also deals with my problem of trying to 
refer to the raster objects, not the names of the objects.

John