You are here:
Geoprocessing tool reference
>
Data Management toolbox
>
Raster toolset
>
Tools
Mosaics multiple input rasters into a single raster dataset. The target raster must be an existing raster dataset, which can be an empty raster dataset or one already containing data.
Learn more about mosaicking raster datasets
Illustration
Usage tips
Command line and Scripting
-
Mosaic is useful when a set of adjacent raster datasets needs to be merged into one entity and also when minimizing the abrupt changes along the boundaries of the overlapping rasters.
-
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 to determine how to handle a colormap, if the raster dataset uses one. For example, you can keep the colormap of the last raster dataset used in the mosaic.
-
For mosaicking of discrete data, the First, Last, Minimum, or Maximum options will give the most meaningful results. The Blend and Mean options are best suited for continuous data.
-
Whenever possible, use Last mosaic option to mosaic raster datasets to an existing raster dataset in File geodatabase or ArcSDE geodatabase; it is by far the most effective way to mosaic.
-
The pixel type will be the same as the target raster dataset.
-
When mosaicking with raster datasets containing colormaps, it is important to note differences across the colormaps for each raster dataset you choose to mosaic. You are still able to use Mosaic tool even if the raster datasets have different colormaps; however, you must choose the proper colormap mode. If an improper colormap mode is chosen, your output might not turn out as you expected.
-
For floating-point input raster datasets of different resolutions, it is recommended that you esample all the data using bilinear interpolation or cubic convolution before running Mosaic. Otherwise, Mosaic will automatically resample the rasters using nearest neighbor (which is not appropriate for the continuous type of data).
-
The Mosaic tool doesn't use the Output Extent, because the tool tends to create very large raster datasets, and the Output Extent setting might accidentally clip your data. If output extent does need to be adjusted, the Clip tool can achieve that operation.
-
The following environments affect this tool: current workspace and scratch workspace.
Command line syntax
An overview of the Command Line window
Mosaic_management <inputs;inputs...> <target> {mosaic_type} {REJECT | FIRST | LAST | MATCH} {background_value} {nodata_value} {NONE | OneBitTo8Bit} {mosaicking_tolerance}
<inputs;inputs...> |
The input raster datasets.
|
Raster Layer |
<target> |
The target raster dataset.
This raster dataset must already exist.
|
Raster Dataset |
{mosaic_type} |
The method used to mosaic overlapping areas.
- FIRST —
The output cell value of the overlapping areas will be the value from the first raster dataset in the list.
- LAST —
The output cell value of the overlapping areas will be the value from the last raster dataset in the list. This is the default (and is also the fastest mosaic type).
- BLEND —
The output cell value of the overlapping areas will be a blend of values that overlap; this blend value is based on an algorithm that is weight based and is dependent on the distance from the pixel to the edge within the overlapping area.
- MEAN —
The output cell value of the overlapping areas will be the mean value of the overlapped cells.
- MINIMUM —
The output cell value of the overlapping areas will be the minimum value of the overlapped cells.
- MAXIMUM —
The output cell value of the overlapping areas will be the maximum value of the overlapped cells.
|
String |
{REJECT | FIRST | LAST | MATCH} |
The method used to choose which colormap from the input rasters will be applied to the mosaic output.
- REJECT —
Only the raster datasets that do not have a colormap associated with them will be mosaicked.
- FIRST —
The colormap from the first raster dataset in the list will be applied to the output raster dataset. This is the default.
- LAST —
The colormap from the last raster dataset in the list will be applied to the output raster dataset.
- MATCH —
Makes sure that the colors in the final colormap are all unique.
|
String |
{background_value} |
Specifies the pixel value in the raster dataset that would be recognized as a background value, and not a valuable part of the data. The pixel value specified will be set to NoData in the output raster dataset. Use this option after rotating or projecting an image to remove the unwanted values created around the original raster data. Even if this value is not unique in the dataset, it 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.
|
Double |
{nodata_value} |
All the pixels with the specified value will be set to NoData in the output raster dataset.
|
Double |
{NONE | OneBitTo8Bit} |
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. 1-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 properly appearing raster dataset in the display.
- NONE —
No conversion will be done. This is the default.
- OneBitTo8Bit —
The input raster will be converted.
|
Boolean |
{mosaicking_tolerance} |
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; the valid value range is 0 to 0.9999. The maximum a pixel can be shifted is 0.5, so anything you set that is greater than 0.5 will guaranty a shift takes place. A tolerance of zero guaranty 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 |
Data types for geoprocessing tool parameters
Command line example
mosaic_management D:\images\raster1;D:\images\raster2;D:\images\raster3 D:\California.mdb\NewRasterDataset LAST MATCH 0 # NONE 0
Scripting syntax
About getting started with writing geoprocessing scripts
Mosaic_management (inputs, target, mosaic_type, colormap, background_value, nodata_value, onebit_to_eightbit, mosaicking_tolerance)
inputs (Required) |
The input raster datasets.
|
Raster Layer |
target (Required) |
The target raster dataset.
This raster dataset must already exist.
|
Raster Dataset |
mosaic_type (Optional) |
The method used to mosaic overlapping areas.
- FIRST —
The output cell value of the overlapping areas will be the value from the first raster dataset in the list.
- LAST —
The output cell value of the overlapping areas will be the value from the last raster dataset in the list. This is the default (and is also the fastest mosaic type).
- BLEND —
The output cell value of the overlapping areas will be a blend of values that overlap; this blend value is based on an algorithm that is weight based and is dependent on the distance from the pixel to the edge within the overlapping area.
- MEAN —
The output cell value of the overlapping areas will be the mean value of the overlapped cells.
- MINIMUM —
The output cell value of the overlapping areas will be the minimum value of the overlapped cells.
- MAXIMUM —
The output cell value of the overlapping areas will be the maximum value of the overlapped cells.
|
String |
colormap (Optional) |
The method used to choose which colormap from the input rasters will be applied to the mosaic output.
- REJECT —
Only the raster datasets that do not have a colormap associated with them will be mosaicked.
- FIRST —
The colormap from the first raster dataset in the list will be applied to the output raster dataset. This is the default.
- LAST —
The colormap from the last raster dataset in the list will be applied to the output raster dataset.
- MATCH —
Makes sure that the colors in the final colormap are all unique.
|
String |
background_value (Optional) |
Specifies the pixel value in the raster dataset that would be recognized as a background value, and not a valuable part of the data. The pixel value specified will be set to NoData in the output raster dataset. Use this option after rotating or projecting an image to remove the unwanted values created around the original raster data. Even if this value is not unique in the dataset, it 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.
|
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. 1-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 properly appearing raster dataset in the display.
- NONE —
No conversion will be done. This is the default.
- OneBitTo8Bit —
The 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; the valid value range is 0 to 0.9999. The maximum a pixel can be shifted is 0.5, so anything you set that is greater than 0.5 will guaranty a shift takes place. A tolerance of zero guaranty 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 |
Data types for geoprocessing tool parameters
Script example
# Mosaic_sample.py
# Description: Mosaic rasters to an existing raster dataset
# Requirements: None
# Author: ESRI
# Date: 1/28/04
import arcgisscripting
gp = arcgisscripting.create()
gp.workspace = "c:/redlands_data"
gp.Mosaic_management("redlands1.tif; redlands2.tif" , "Database Connections\Connection to raster.sde\raster.redlands","LAST","MATCH", "0", "#", "NONE", "0")
Map Algebra syntax
See Merge or Mosaic
ArcObjects syntax
There is no corresponding ArcGIS Spatial Analyst object to perform Merge or Mosaic. However, in core ArcGIS, similar functionality can be found in the IRasterGeometryProc object.
For more information, see ArcObjects Developer Help.