I have an empty raster and point shapefile (points = black dots in the image). For the analysis I use a Digital Elevation Model (DEM) with the same extent and cell size as the empty raster.
I would like to fill the empty raster cells with the elevation difference between every raster cell of the empty raster and the raster cell where the closest point is situated.
The green lines show distance between every raster cell the respective closest point.
Result: a raster with every cell filled difference in elevation between the cell elevation and the elevation from the cell where the point is located.
The first thing to know is: Which is the closest point? The distance between a raster cell and the closest point can be calculated with the distanceFromPoint tool:
r <- raster('./Raster/DEM/DEM_Refocus_5kmBuffer.tif')
s <- readOGR('./Shapefiles und CSV/River/Rive_Punkte_3035.shp')
dfp <- distanceFromPoints(r, s)
But what I actually need is the elevation differnce between every raster cell of the raster and the the points. Do you have an idea to obtain this?