How Mosaic works

Map Algebra

The Mosaic function works similarly to the Merge function. When the rasters to be put together do not have an overlapping area, there is no difference in the output from either function. The difference is the processing of the overlapping areas. In the case of Merge, the sequence of input rasters determines the values assigned to cells over the common map extent, giving priority to those entered first.

For Mosaic, the sequence of entry on the command line is irrelevant, if on each overlapping area, no more than two rasters intersect. Mosaic uses a weighted average method to calculate values of cells in the overlapping area, taking input from two or more input rasters. The proximity analysis algorithm applied to determine cell values over the overlapping areas is called the Hermite Cubic and can be described by the following formula:

H3(s) = 1 - 3s2 + 2s3

where s is the normalized distance (ranging values from 0 to 1) of the width of the overlapping area (it may be oriented horizontally or vertically).

The cell values for the output C raster, being the mosaic of rasters A and B (see left diagram below) on the overlapping area (marked x on the diagram), are calculated according to the following formula:

C = AH + B(1 - H)

Mosaic formula

The right diagram above shows graphically how the applied weighted average method works on the overlapping area. The ratio of weights of the overlapping rasters changes within the width(s) of the x area.

For the purpose of explanation, each of the two input rasters used in the Illustration section represents a discrete type of data, which, in general, is not applicable for mosaicking. The input rasters have different map extents, one is shifted versus the other for one column, with the five columns being common for both. The one called ingrid2 is a floating-point raster while the other is an integer.

If the input rasters are of the integer type of data, the output raster would also be integer and the values of the output raster would be truncated.

The Mosaic function itself will not interpolate to fill missing data that may occur while putting a set of rasters into one composite entity. The following Map Algebra expression can help solve the problem by interpolating values of the missing cells. It will fill gaps of up to three rows or columns of NoData cells (the length of the gap is unrelated) with the mean cell value of the 4 x 4 square, leaving the valid existing data unchanged. If the gap is wider than three cells, the size of the focal window may be conservatively increased.

con (isnull(gap_mosaic), focalmean (gap_mosaic, rectangle,4,4), gap_mosaic)


Franke, R. (1982). Smooth Interpolation of Scattered Data by Local Thin Plate Splines. Comp. & Maths with Appls. Vol. 8, No. 4, pp. 273-281. Pergamon Press Ltd.