Closed bienflorencia closed 1 month ago
Your are doing the equivalent of
r <- rast(res=10000, ext=c(-82, -68, -19, 1), crs="+proj=longlat")
And that gives you
r
#class : SpatRaster
#dimensions : 1, 1, 1 (nrow, ncol, nlyr)
#resolution : 10000, 10000 (x, y)
#extent : -82, 9918, -19, 9981 (xmin, xmax, ymin, ymax)
#coord. ref. : +proj=longlat +datum=WGS84 +no_defs
That happens because we need to accommodate the extent you requested with the resolution. Your resolution is 1000 degrees! That is, of course, non-sensical. I assume that you want a resolution of approximately 1000 m (~ 30 seconds of a degree, or 1/120 degrees).
r <- rast(res=1/120, ext=c(-82, -68, -19, 1), crs="+proj=longlat")
#class : SpatRaster
#dimensions : 2400, 1680, 1 (nrow, ncol, nlyr)
#resolution : 0.008333333, 0.008333333 (x, y)
#extent : -82, -68, -19, 1 (xmin, xmax, ymin, ymax)
#coord. ref. : +proj=longlat +datum=WGS84 +no_defs
Thank you, Robert! The resolution unit was intended for a layer with projected coordinates (in meters), and I mistakenly didn't change it to crs=4326
and latlong units.
I'm getting an error when trying to resample a raster layer. The error appears when I create the raster to use as a template. Here's a reprex:
If I try with
vect(peru)
I have the same error.Thanks!