Mosaic (Data Management)

Summary

Merges multiple existing raster datasets or mosaic datasets into an existing raster dataset.

Illustration

Mosaic tool illustration

Usage

  • The target raster must be an existing raster dataset, which can be an empty raster dataset or one that contains data.

  • Mosaic is useful when two or more adjacent raster datasets need to be merged into one entity. Some mosaic techniques can help minimize the abrupt changes along the boundaries of the overlapping rasters. If the target raster is a CRF format raster, the extent will be updated.

  • A multidimensional raster dataset can be created by adding one or more multidimensional rasters to an empty expandable CRF raster dataset. The multidimensional information from the first input multidimensional raster will be used to define the multidimensional information of the expandable raster dataset.

  • The overlapping areas of the mosaic can be handled in several ways; for example, you can set the tool to keep only the first raster dataset's data, or you can blend the overlapping cell values. There are also several options for handling a color map, if the raster dataset uses one. For example, you can keep the color map of the most recent raster dataset used in the mosaic.

  • The Target Raster parameter value is considered the first raster in the list of input rasters.

  • For mosaicking of discrete data, the First, Minimum, or Maximum option in Mosaic Operator will provide the most meaningful results. The Blend and Mean options are best suited for continuous data.

  • Whenever possible, use the Last option for the Mosaic Operator parameter to mosaic raster datasets to an existing raster dataset in a geodatabase; it is the most effective way to mosaic.

  • For file-based rasters, Ignore Background Value must be set to the same value as NoData for the background value to be ignored. Geodatabase rasters will work without this extra step.

  • When mosaicking with raster datasets containing color maps, it is important to note the differences across the color maps for each raster dataset you mosaic. You can use the Mosaic tool even if the raster datasets have different color maps; however, you must choose the proper color map mode. If an improper color map mode is chosen, the output may not turn out as you expect.

  • The Color Matching Method parameter allows you to choose an algorithm to color match the datasets in your mosaic.

  • For floating-point input raster datasets of different resolutions or when cells are not aligned, it is recommended that you resample all the data using bilinear interpolation or cubic convolution before running Mosaic. Otherwise, Mosaic will automatically resample the raster datasets using nearest neighbor resampling, which is not appropriate for continuous data types.

  • The Mosaic tool doesn't use the output extent environment setting because the tool tends to create very large raster datasets and the output extent setting may clip the data. If the output extent does need to be adjusted, use the Clip tool to clip the Target Raster parameter value after processing.

  • When the target raster is a multidimensional CRF, only the matching slices at the same dimensions for the same variable will be updated.

  • The Mosaic tool supports expandable CRF data. If the CRF dataset was created using the Create Raster Dataset tool, you can update the mosaic dataset with new data, and the extent will be adjusted automatically.

  • The target raster and input rasters must have the same number of bands.

Parameters

LabelExplanationData Type
Input Rasters

The raster datasets to be merged.

Mosaic Dataset; Raster Dataset; Raster Layer
Target Raster

The raster to which the input rasters will be added. This must be an existing raster dataset. By default, the target raster is considered the first raster in the list of input raster datasets. You can create an empty raster using the Create Raster Dataset tool.

Raster Dataset
Mosaic Operator
(Optional)

Specifies the method that will be used to mosaic overlapping areas.

For more information about each mosaic operator, see the Mosaic Operator help topic.

  • FirstThe output cell value of the overlapping areas will be the value from the first raster dataset mosaicked into that location.
  • LastThe output cell value of the overlapping areas will be the value from the last raster dataset mosaicked into that location. This is the default.
  • BlendThe output cell value of the overlapping areas will be a horizontally weighted calculation of the values of the cells in the overlapping area.
  • MeanThe output cell value of the overlapping areas will be the average value of the overlapping cells.
  • MinimumThe output cell value of the overlapping areas will be the minimum value of the overlapping cells.
  • MaximumThe output cell value of the overlapping areas will be the maximum value of the overlapping cells.
  • SumThe output cell value of the overlapping areas will be the total sum of the overlapping cells.
String
Mosaic Colormap Mode
(Optional)

Specifies the method that will be used to choose which color map from the input rasters will be applied to the mosaic output.

For more information about each colormap mode, see the Mosaic colormap mode help topic.

  • FirstThe color map from the first raster dataset in the list will be applied to the output raster mosaic. This is the default.
  • LastThe color map from the last raster dataset in the list will be applied to the output raster mosaic.
  • MatchAll the color maps will be considered when mosaicking. If all possible values are already used (for the bit depth), the tool will match the value with the closest available color.
  • RejectOnly the raster datasets that do not have a color map associated with them will be mosaicked.
String
Ignore Background Value
(Optional)

Remove the unwanted values created around the raster data. The value specified will be distinguished from other valuable data in the raster dataset. For example, a value of zero along the raster dataset's borders will be distinguished from zero values in the raster dataset.

The pixel value specified will be set to NoData in the output raster dataset.

For file-based rasters and geodatabase rasters, Ignore Background Value must be set to the same value as NoData for the background value to be ignored. Enterprise geodatabase rasters will work without this extra step.

Double
NoData Value
(Optional)

All the pixels with the specified value will be set to NoData in the output raster dataset.

Double
Convert 1 bit data to 8 bit
(Optional)

Specifies whether the input 1-bit raster dataset will be converted to an 8-bit raster dataset. In this conversion, the value 1 in the input raster dataset will be changed to 255 in the output raster dataset. This is useful when importing a 1-bit raster dataset to a geodatabase. One-bit raster datasets have 8-bit pyramid layers when stored in a file system, but in a geodatabase, 1-bit raster datasets can only have 1-bit pyramid layers, which results in a lower-quality display. By converting the data to 8 bit in a geodatabase, the pyramid layers are built as 8 bit instead of 1 bit, resulting in a proper raster dataset in the display.

  • Unchecked—No conversion will occur. This is the default.
  • Checked—The input raster will be converted.
Boolean
Mosaicking Tolerance
(Optional)

When mosaicking occurs, the target and the source pixels do not always line up exactly. When there is a misalignment of pixels, you need to decide whether to resample or shift the data. The mosaicking tolerance controls whether resampling of the pixels will occur or the pixels will be shifted.

If the difference in pixel alignment (of the incoming dataset and the target dataset) is greater than the tolerance, resampling will occur. If the difference in pixel alignment (of the incoming dataset and the target dataset) is less than the tolerance, resampling will not occur and a shift will be performed.

The unit of tolerance is a pixel with a valid value range of 0 to 0.5. A tolerance of 0.5 will guarantee a shift occurs. A tolerance of zero guarantees resampling will occur if there is a misalignment in pixels.

For example, the source and target pixels have a misalignment of 0.25. If the mosaicking tolerance is set to 0.2, resampling will occur since the pixel misalignment is greater than the tolerance. If the mosaicking tolerance is set to 0.3, the pixels will be shifted.

Double
Color Matching Method
(Optional)

Specifies the color matching method that will be applied to the rasters.

  • NoneNo color matching method will be applied when mosaicking the raster datasets.
  • Match statisticsDescriptive statistics from the overlapping areas will be matched; the transformation will then be applied to the entire target dataset.
  • Match histogramThe histogram from the reference overlap area will be matched to the source overlap area; the transformation will then be applied to the entire target dataset.
  • Linear correlationOverlapping pixels will be matched and the rest of the source dataset will be interpolated; pixels without a one-to-one relationship will use a weighted average.
String

Derived Output

LabelExplanationData Type
Updated Target Raster

The updated raster dataset.

Raster Dataset

arcpy.management.Mosaic(inputs, target, {mosaic_type}, {colormap}, {background_value}, {nodata_value}, {onebit_to_eightbit}, {mosaicking_tolerance}, {MatchingMethod})
NameExplanationData Type
inputs
[input,...]

The raster datasets to be merged.

Mosaic Dataset; Raster Dataset; Raster Layer
target

The raster to which the input rasters will be added. This must be an existing raster dataset. By default, the target raster is considered the first raster in the list of input raster datasets. You can create an empty raster using the Create Raster Dataset tool.

Raster Dataset
mosaic_type
(Optional)

Specifies the method that will be used to mosaic overlapping areas.

  • FIRSTThe output cell value of the overlapping areas will be the value from the first raster dataset mosaicked into that location.
  • LASTThe output cell value of the overlapping areas will be the value from the last raster dataset mosaicked into that location. This is the default.
  • BLENDThe output cell value of the overlapping areas will be a horizontally weighted calculation of the values of the cells in the overlapping area.
  • MEANThe output cell value of the overlapping areas will be the average value of the overlapping cells.
  • MINIMUMThe output cell value of the overlapping areas will be the minimum value of the overlapping cells.
  • MAXIMUMThe output cell value of the overlapping areas will be the maximum value of the overlapping cells.
  • SUMThe output cell value of the overlapping areas will be the total sum of the overlapping cells.
String
colormap
(Optional)

Specifies the method that will be used to choose which color map from the input rasters will be applied to the mosaic output.

  • FIRSTThe color map from the first raster dataset in the list will be applied to the output raster mosaic. This is the default.
  • LASTThe color map from the last raster dataset in the list will be applied to the output raster mosaic.
  • MATCHAll the color maps will be considered when mosaicking. If all possible values are already used (for the bit depth), the tool will match the value with the closest available color.
  • REJECTOnly the raster datasets that do not have a color map associated with them will be mosaicked.
String
background_value
(Optional)

Remove the unwanted values created around the raster data. The value specified will be distinguished from other valuable data in the raster dataset. For example, a value of zero along the raster dataset's borders will be distinguished from zero values in the raster dataset.

The pixel value specified will be set to NoData in the output raster dataset.

For file-based rasters and geodatabase rasters, Ignore Background Value must be set to the same value as NoData for the background value to be ignored. Enterprise geodatabase rasters will work without this extra step.

Double
nodata_value
(Optional)

All the pixels with the specified value will be set to NoData in the output raster dataset.

Double
onebit_to_eightbit
(Optional)

Specifies whether the input 1-bit raster dataset will be converted to an 8-bit raster dataset. In this conversion, the value 1 in the input raster dataset will be changed to 255 in the output raster dataset. This is useful when importing a 1-bit raster dataset to a geodatabase. One-bit raster datasets have 8-bit pyramid layers when stored in a file system, but in a geodatabase, 1-bit raster datasets can only have 1-bit pyramid layers, which results in a lower-quality display. By converting the data to 8 bit in a geodatabase, the pyramid layers are built as 8 bit instead of 1 bit, resulting in a proper raster dataset in the display.

  • NONENo conversion will occur. This is the default.
  • OneBitTo8BitThe input raster will be converted.
Boolean
mosaicking_tolerance
(Optional)

When mosaicking occurs, the target and the source pixels do not always line up exactly. When there is a misalignment of pixels, you need to decide whether to resample or shift the data. The mosaicking tolerance controls whether resampling of the pixels will occur or the pixels will be shifted.

If the difference in pixel alignment (of the incoming dataset and the target dataset) is greater than the tolerance, resampling will occur. If the difference in pixel alignment (of the incoming dataset and the target dataset) is less than the tolerance, resampling will not occur and a shift will be performed.

The unit of tolerance is a pixel with a valid value range of 0 to 0.5. A tolerance of 0.5 will guarantee a shift occurs. A tolerance of zero guarantees resampling will occur if there is a misalignment in pixels.

For example, the source and target pixels have a misalignment of 0.25. If the mosaicking tolerance is set to 0.2, resampling will occur since the pixel misalignment is greater than the tolerance. If the mosaicking tolerance is set to 0.3, the pixels will be shifted.

Double
MatchingMethod
(Optional)

Specifies the color matching method that will be applied to the rasters.

  • NONENo color matching method will be applied when mosaicking the raster datasets.
  • STATISTIC_MATCHINGDescriptive statistics from the overlapping areas will be matched; the transformation will then be applied to the entire target dataset.
  • HISTOGRAM_MATCHINGThe histogram from the reference overlap area will be matched to the source overlap area; the transformation will then be applied to the entire target dataset.
  • LINEARCORRELATION_MATCHINGOverlapping pixels will be matched and the rest of the source dataset will be interpolated; pixels without a one-to-one relationship will use a weighted average.
String

Derived Output

NameExplanationData Type
output

The updated raster dataset.

Raster Dataset

Code sample

Mosaic example 1 (Python window)

This is a Python sample for the Mosaic function.

import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.Mosaic_management("land2.tif;land3.tif","land1.tif","LAST","FIRST",
                        "0", "9", "", "", "")
Mosaic example 2 (stand-alone script)

This is a Python script sample for the Mosaic function.

##==================================
##Mosaic
##Usage: Mosaic_management inputs;inputs... target {LAST | FIRST | BLEND | MEAN | MINIMUM | MAXIMUM} {FIRST | REJECT | LAST | MATCH} 
##                         {background_value} {nodata_value} {NONE | OneBitTo8Bit} {mosaicking_tolerance}  
##                         {NONE | STATISTIC_MATCHING | HISTOGRAM_MATCHING 
##                         | LINEARCORRELATION_MATCHING}

import arcpy
arcpy.env.workspace = r"\\workspace\PrjWorkspace\RasGP"

##Mosaic two TIFF images to a single TIFF image
##Background value: 0
##Nodata value: 9
arcpy.Mosaic_management("landsatb4a.tif;landsatb4b.tif","Mosaic\\landsat.tif","LAST","FIRST","0", "9", "", "", "")

##Mosaic several 3-band TIFF images to FGDB Raster Dataset with Color Correction
##Set Mosaic Tolerance to 0.3. Mismatch larget than 0.3 will be resampled
arcpy.Mosaic_management("rgb1.tif;rgb2.tif;rgb3.tif", "Mosaic.gdb\\rgb","LAST","FIRST","", "", "", "0.3", "HISTOGRAM_MATCHING")

Related topics