Simple script for patching rasters and smoothing along edges
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Makefile note about addons Feb 9, 2018
r.patch.smooth.html add reference to manual Nov 5, 2017


Please use version from GRASS GIS Addons repository, you can install it with:

g.extension r.patch.smooth

This repository will become eventually obsolete.


GRASS GIS module r.patch.smooth fuses rasters representing elevation together by patching them and smoothing values along edges using either fixed or spatially variable overlap width. Spatially variable overlap width is given by the difference along the edge between the two rasters. Higher difference results in larger overlap width to smooth the transition.

r.patch.smooth can be used, for example, for updating older, lower resolution DEM (input_b) with newer, higher resolution DEM (input_a). Note that both DEMs must be aligned and have the same resolution. Smoothing uses weighted averaging on the overlap of the rasters. r.patch.smooth supports 2 types of smoothing. The default one is simpler and uses fixed overlap width defined in smooth_dist. Since the differences along the seam line can vary, the second option uses spatially variable overlap width and can be activated with flag -s. The width is then computed based on the elevation differences along the edge and transition angle transition_angle controlling the steepness of the transition. If option overlap is specified, a map representing the spatially variable overlap is created and can be used for inspecting the fusion results.

Difference between fixed overlap width and spatially variable overlap.

For spatially variable overlap, options parallel_smoothing and difference_reach can be specified. Option parallel_smoothing smoothes the overlap zone in direction parallel to the edge. Option difference_reach enables to increase the sensitivity to higher differences on the edges by taking maximum difference values in the cells close to edges.

Effect of parallel_smoothing option shown on overlap zone (created by specifying overlap option). Image A shows result with value 3 and B with value 9.

Option blend_mask (experimental) can be used to specify which edges of the input_a DEM should be excluded from the blending. This is useful when DEMs A and B have identical edges (on the coast, for example) and we want to preserve only A (not blend it with B along the coast). The blend_mask raster can be created by digitizing area approximately around the excluded edges, so that the edge of DEM A is inside the areas and the rest are NULLs. This option requires more testing.


Module r.patch.smooth must be run from GRASS GIS 7 environment. Within GRASS session, run in command line:

g.extension r.patch.smooth url=