-
Notifications
You must be signed in to change notification settings - Fork 107
Description
The mosaic function in ArcGIS merges two overlapping raster boundaries with smooth transition on one side (at least the last time I used it for this purpose many years ago), but the mosaic function in Terra only averages the area of overlap. Neither mosaic performs well with overlapping rasters involving more than one edge. There are many scenarios where I would like to patch a small area of a DEM raster with new values without affecting the rest of the raster. I propose a possible new feature to "splice" rasters to ensure a smooth transition no matter the edge of overlap. There may yet be more elegant solutions to detecting the edges and applying the right smoothing function, but I have written scripts that seem to work for most scenarios. I developed it specifically because I want to try splicing multiple GAM models of climate point data with a shifting window of lat/lon. [Global models do not easily accommodate locally changing parameters and I know that the edges will not match between modelled areas.]
https://github.com/phytoclast/climatools/blob/master/R/splice.R
rg <- genrast(c(1,-1,-1,1))
r1 <- rg[[1]]
r2 <- rg[[2]]
plot(mosaic(r1,r2))

m1 <- spliceraster(r1,r2)
plot(m1)
