Mosaic (Data Management)

License Level:BasicStandardAdvanced

Summary

Mosaics multiple input rasters into an existing raster dataset.

Learn more about mosaicking raster datasets

Illustration

Mosaic illustration

Usage

Syntax

Mosaic_management (inputs, target, {mosaic_type}, {colormap}, {background_value}, {nodata_value}, {onebit_to_eightbit}, {mosaicking_tolerance}, {MatchingMethod})
ParameterExplanationData Type
inputs
[input,...]

The input raster datasets.

Mosaic Dataset ; Composite Layer ; Raster Dataset ; Raster Layer
target

The target raster dataset.

This raster dataset must already exist. The Target layer is considered the first raster in the list of Input Rasters.

Raster Dataset
mosaic_type
(Optional)

The method 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.

The Target layer is considered the first raster in the list of Input Rasters.

For more information about each mosaic operator, refer to Mosaic Operator.

String
colormap
(Optional)

The method 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.
  • MATCHWill take all the color maps into consideration when mosaicking. If all possible values are already used (for the bit depth), it will attempt to match the value with the closest color that is available.
  • REJECTOnly the raster datasets that do not have a color map associated with them will be mosaicked.

The Target layer is considered the first raster in the list of Input Rasters.

For more information about each colormap mode, refer to Mosaic colormap mode.

String
background_value
(Optional)

Use this option to 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 within the raster dataset.

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

For file-based rasters and personal geodatabase rasters, the Ignore Background Value must be set to the same value as NoData in order for the background value to be ignored. ArcSDE and file 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)

Choose 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 ArcSDE. One-bit raster datasets have 8-bit pyramid layers when stored in a file system, but in ArcSDE, 1-bit raster datasets can only have 1-bit pyramid layers, which makes the display unpleasant. By converting the data to 8 bit in ArcSDE, the pyramid layers are built as 8 bit instead of 1 bit, resulting in a proper raster dataset in the display.

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

When mosaicking takes place, the target and the source pixels do not always line up exactly. When there is a misalignment of pixels, a decision needs to be made whether resampling takes place or whether the data should be shifted. The mosaicking tolerance controls whether resampling of the pixels take place or if the pixels should be shifted.

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

The unit of tolerance is a pixel, where the valid value range is 0 to 0.5. A tolerance of 0.5 will guarantee a shift takes place. A tolerance of zero guarantees resampling, 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, then resampling will take place since the pixel misalignment is greater than the tolerance. If the mosaicking tolerance is set to 0.3, then the pixels will be shifted.

Double
MatchingMethod
(Optional)

Choose the color matching method to apply to the rasters.

  • NONEThis option will not use the color matching operation when mosaicking your raster datasets.
  • STATISTICS_MATCHINGThis method will match the statistical differences (minimum, maximum, and mean) between the reference overlap area and the source overlap area; the transformation will then be applied to the entire target dataset.
  • HISTOGRAM_MATCHINGThis method will match the histogram from the reference overlap area with the source overlap area; the transformation will then be applied to the entire target.
  • LINEARCORRELATION_MATCHINGThis method will match overlapped pixels and interpolate to the rest of the source; pixels that do not have a one-to-one relationship will use a weighted average.
String

Code Sample

Mosaic example 1 (Python window)

This is a Python sample for the Mosaic tool.

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 tool.

##==================================
##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}
try:
    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")
except:
    print "Mosaic example failed."
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015