# NOT RUN {
r <- rast(nrow=3, ncol=3, xmin=0, xmax=10, ymin=0, ymax=10)
values(r) <- 1:ncell(r)
s <- rast(nrow=25, ncol=30, xmin=1, xmax=11, ymin=-1, ymax=11)
x <- warp(r, s, method='bilinear')
par(mfrow=c(1,2))
plot(r)
plot(x)
# warp to different CRS
a <- rast(ncol=40, nrow=40, xmin=-110, xmax=-90, ymin=40, ymax=60,
crs="+proj=longlat +datum=WGS84")
values(a) = 1:ncell(a)
b <- rast(ncol=94, nrow=124, xmin=-944881, xmax=935118, ymin=4664377, ymax=7144377,
crs="+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +datum=WGS84")
w <- warp(a, b)
# }
Run the code above in your browser using DataLab