I have several DEMs as geotiff files which I load into R using raster::raster
. Now some of these DEMs contain patches of missing values, represented by NA
. I would like to interpolate these missing values from the surrounding cells using Kriging.
One approach I tried was the raster::interpolate
function. However, the examples in the documentation use spatial points data frames as predictors (from the "meuse" data set) and I can't figure out how it works for my raster.
I have also seen this, but the approach suffers from the same problem (interpolation of a raster from points). A similar example is this.
Several other questions on https://gis.stackexchange.com address similar issues, however none of them provided a working solution for me.
What I also tried is the R package filling. After converting my raster to a matrix, several functions therein work for me, yet I am not sure if these methods are appropriate for the problem at hand.