I am trying to reproject a raster from Cylindrical Equal-Area (Lambert). Central Meridian: -160. Datum: WGS 1984 to latitude and longitude But I'm getting multiple error messages. The original raster looks like this when plotted with rasterVis:
My code is as follows:
library(raster)
#read raster
raster(r)
# Define new Proj.4 spatial reference
sr <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
# Project Raster
projected_raster <- projectRaster(r, crs = sr)
#But I get the following errors:
Error in if (maxy == miny) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, :
53 projected point(s) not finite
I am not sure whether this is a problem with the raster or my code? Please help!
CRS
in your code: sr <- CRS("+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0")gdaltransform()
fromgdalUtils
package