rspatial / terra

R package for spatial data handling https://rspatial.github.io/terra/reference/terra-package.html
GNU General Public License v3.0
543 stars 90 forks source link

rasterize fails with update=T #1611

Closed Jadamso closed 1 month ago

Jadamso commented 1 month ago

One of the recent updates to terra now causes rasterize to fail when update=T.

Here is a minimal example for terra_1.7-78

library(terra)
y_rast <- rast( matrix(runif(100),10,10))
x_point <- vect( data.frame(x=runif(4),y=runif(4)), geom=c("x", "y"))
rasterize(
    x_point, y_rast,
    fun=sum, na.rm=T, update=T, background=NA)
rhijmans commented 1 month ago

Thanks, I now get :

rasterize(x_point, y_rast, fun=sum, update=TRUE)
#class       : SpatRaster 
#dimensions  : 10, 10, 1  (nrow, ncol, nlyr)
#resolution  : 1, 1  (x, y)
#extent      : 0, 10, 0, 10  (xmin, xmax, ymin, ymax)
#coord. ref. :  
#source(s)   : memory
#name        :          sum 
#min value   : 0.0008639263 
#max value   : 4.0000000000