[R-sig-Geo] apply() proj4string to list of rasters
john polo
jpolo at mail.usf.edu
Tue Nov 1 19:50:51 CET 2016
On 11/1/2016 1:39 PM, Roger Bivand wrote:
>
> My guess is that the underlying problem was the use of lapply() rather
> than a for() loop, and not reading the help page for assigning:
>
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
--
Men occasionally stumble
over the truth, but most of them
pick themselves up and hurry off
as if nothing had happened.
-- Winston Churchill
More information about the R-sig-Geo
mailing list