I am trying to reproject a raster and change its resolution with the function projectRaster() in R.
I looked up at the R documentation website (https://www.rdocumentation.org/packages/raster/versions/2.5-8/topics/projectRaster) and found the following code for it:
projectRaster(from, to, res, crs, method="bilinear", alignOnly=FALSE, over=FALSE, filename="", ...)
I tried to replicate it using the following code:
newproj <- "+proj=aea +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m" projectRaster(lradin, 94.65157575, crs = newproj, +datum=WGS84, method="bilinear", filename="lradin_1", overwrite = TRUE)
Here, lradin is the raster object, 94.65157575 is the resolution that I am changing to (in meters).
My original raster (lradin) is in WGS1984 coordinate system with a resolution of 0.1° x 0.1° and I need to change it in Asia North Albers Equal Area Conic projection with a resolution of 94.65157575 meters.
When I run the code I get the following error:
Error in projectRaster(r, a, 94.65157575, crs = newproj, method = "bilinear", : output projection is NA
I am not understanding what the error is. I feel I have written the code according to the documentation website. Could anyone suggest something ?