geo-registry

Mosaic

Combines several rasters into one covering all of them.

Pitfall. Where inputs overlap, engines differ on which value wins (first, last, mean); check before mosaicking overlapping tiles.
Pitfall. Inputs with different cell sizes or CRSs are resampled or refused depending on the engine.
About this operation
Also called Mosaic To New Raster, merge rasters, gdal_merge, stitch tiles, virtual mosaic
Group raster/combine
Checks crs.agreement, raster.nodata
Pitfalls 2 listed above
Columbus tool Not stated
Notes Not stated
Status active
Broader Not stated
Narrower Not stated
Related

Parameters

Not stated

Inputs and outputs

Direction Name Type Geometry Note
Input rasters raster (several) Not stated Not stated
Output output raster Not stated Not stated

In each engine

Engine Tool Parameters Differences
gdal gdal raster mosaic
  • rasters → input
  • output → output
  • Builds a virtual mosaic (VRT) unless the output is another format.
grass r.patch
  • rasters → input
  • output → output
  • The first map listed has priority; later maps only fill its no-data cells. The output covers the computational region.
postgis-raster st_union
  • rasters → #1
  • An aggregate over raster rows; uniontype (LAST by default) chooses the value where tiles overlap.
qgis gdal:merge
  • rasters → INPUT
  • output → OUTPUT
  • Runs gdal_merge; where inputs overlap the last one in the list is copied over earlier ones.
rasterio rasterio.merge.merge
  • rasters → sources
  • Returns an array and its transform; method chooses which value wins where inputs overlap (default first).
rioxarray rioxarray.merge.merge_arrays
  • rasters → dataarrays
None noted
terra terra::merge
  • rasters → x : The rasters go in x, y and further arguments, or a SpatRasterCollection in x.
  • Where inputs overlap, the first raster's values are kept (first = TRUE).
terra terra::mosaic
  • rasters → x : The rasters go in x, y and further arguments, or a SpatRasterCollection in x.
  • Where inputs overlap, fun combines the values (default mean).
whiteboxtools Mosaic
  • rasters → inputs
  • output → output
  • In the equivalence tests the output grid was one row and one column short of the inputs' combined extent (two 10 by 20 halves gave 19 by 19).
xarray-spatial xrspatial.merge
  • rasters → rasters
  • strategy chooses which value wins where inputs overlap (default first); inputs in other CRSs are reprojected.