I have a raster in WGS 1984 coordinate system with the pixel values denoting categorical values i.e. the raster is a land use land cover raster, with each value meaning water bodies, ice, forest etc.
I need to convert it to the unamed ellipse sinusoidal projection (with a linear unit of meters), since my remaining rasters are in this projection. I have tried-
projectRaster(raster in WGS 1984 system, crs(raster in sinusoidal projection), method='ngb' since my raster is categorical as mentioned above).
I get this error message- Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘res’ for signature ‘"CRS"’.
In context to this question, what does the error message mean and how do I solve it such that the projection works.
Best Answer
The help for
projectRaster
looks like this:When you do
projectRaster(r1, r2)
it matches thefrom
andto
arguments, and theto
argument has to be:a
raster
object. But you fed itcrs(raster object)
. You don't need to usecrs
if you have a raster, you can feed it the two rasters:should work. If you only have a crs object, you have to name the parameter so it matches the
crs
argument rather than theto
argument:should also work.