rast <- terra::rast(matrix(c(rep(NA,100), rep(1,100), rep(NA,100)), ncol = 15))
pts <- cbind(runif(100, 0, 5), runif(100, 0, 15))
terra::plot(rast)
points(pts)
pts <- move(pts, rast)
terra::plot(rast)
points(pts)
Run the code above in your browser using DataLab