5.17 Resampling

What to do when we have two or more rasters with different resolutions and origins? This is the role of resampling – a process of computing values for new pixel locations.

  • methods: nearest neighbor, bilinear interpolation, cubic interpolation, cubic spline interpolation, Lanzcos
  • balance between quality and computational time
target_rast = rast(xmin = 794650, xmax = 798250, 
                   ymin = 8931750, ymax = 8935350,
                   resolution = 300, crs = "EPSG:32717")
plot(dem)

plot(terra::resample(dem, y = target_rast, 
                     method = "near"))

plot(terra::resample(dem, y = target_rast, 
                     method = "bilinear"))

plot(terra::resample(dem, y = target_rast, 
                     method = "cubic"))

plot(terra::resample(dem, y = target_rast, 
                     method = "cubicspline"))

plot(terra::resample(dem, y = target_rast, 
                     method = "lanczos"))