why does crop() trigger rgdal?
mdsumner opened this issue · 2 comments
mdsumner commented
if (!is.null(user_extent)) out <- raster::crop(out, user_extent , snap = "out")
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
library(quadmesh)
library(raster)
crop(etopo, extent(100, 120, -50, -30))
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
class : RasterLayer
dimensions : 30, 30, 900 (nrow, ncol, ncell)
resolution : 0.6666667, 0.6666666 (x, y)
extent : 100, 120, -50, -30 (xmin, xmax, ymin, ymax)
crs : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
source : memory
names : layer
values : -6135.5, 658.5 (min, max)
mdsumner commented
crop does a .copyWithProperties() that triggers generic raster() here:
https://github.com/rspatial/raster/blob/master/R/raster.R#L20-L25
if (missing(crs)) {
if (ext@xmin > -360.01 & ext@xmax < 360.01 & ext@ymin > -90.01 & ext@ymax < 90.01) {
crs <- CRS("+proj=longlat +datum=WGS84")
} else {
# if sp >= 1.2.1 crs <- CRS(as.character(NA), doCheckCRSArgs=FALSE)
crs <- CRS(as.character(NA))
So to dump it we need raster to use sp>= 1.2.1 or pivot on that test.
mdsumner commented
This is why: rspatial/raster#87