Closed RS-eco closed 1 year ago
I can't actually reproduce, I'm only on raster_3.5-29 and terra_1.6-7.
But generally use a target grid rather than a bare CRS - sometimes the hueristics to determine a grid are unhelpful. That might be a workaround for now.
ex <- c(-1, 1, -1/2, 1/2) * pi * 6378137
plot(projectRaster(r_grid, raster(extent(ex), res = 1e5, crs = "+proj=moll")))
Thank you for reporting this. This indeed fails with the CRAN version (@mdsumner is one version behind). The current version no longer uses "rgeos" and "rgdal"; the functionality these packages provided now comes from "terra". This transition introduced a few bugs.
This below (your example, simplified), now works for me with the development versions of both "raster" and "terra"
library(rworldmap)
library(raster)
world <- getMap(resolution = "low")
r <- rasterize(outline, raster())
m <- projectRaster(r, crs="+proj=moll +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs")
plot(m)
This code used to work fine in the past, but now throws out a very weird global map, when projecting a WGS84 global map to Mollweide projection. Any ideas what I am doing wrong here?