Approaches for IDW and nearest neighbours

To apply the closest neighbour method, we used terra::voronoi() and stayed with {terra}.

For the IDW & nearest neighbour method, gstat::gstat() is used to define the interpolation algorithm.

However the book applies the gstat result to sf points, then converting back to a SpatRaster:

  • extract cell center coordinates from grid, create sf points object, then filter by map
  • then use the predict() method with the gstat and sf points objects
    • advantage: gstat::gstat() is aware of sf geometries
  • then apply terra::rasterize() to the resulting points with predicted values