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, createsfpoints object, then filter bymap - then use the
predict()method with thegstatandsfpoints objects- advantage:
gstat::gstat()is aware ofsfgeometries
- advantage:
- then apply
terra::rasterize()to the resulting points with predicted values