Summary
Merges multiple raster datasets into a new raster dataset.
Usage
The input raster datasets are all the raster datasets you would like to mosaic together. The inputs must have the same number of bands and same bit depth; otherwise, the tool will exit with an error message.
When working with a large number of raster datasets, the Raster Catalog To Raster Dataset tool performs more efficiently.
The Mosaic tool has more parameters available when combining datasets into an existing raster, such as options to ignore background and nodata values.
You must set the pixel type to match your existing input raster datasets. If you do not set the pixel type, the 8-bit default will be used and your output may be incorrect.
You can save your output to BIL, BIP, BMP, BSQ, DAT, Esri Grid , GIF, IMG, JPEG, JPEG 2000, PNG, TIFF, MRF, CRF, or any geodatabase raster dataset.
When storing your raster dataset to a JPEG file, a JPEG 2000 file, or a geodatabase, you can specify a Compression Type and Compression Quality in the Environments.
The GIF format only supports single-band raster datasets.
When mosaicking with raster datasets containing color maps, it is important to note differences across the color maps for each raster dataset you choose to mosaic. In this situation, use the Mosaic tool for raster with different color maps; however, you must choose the proper Mosaic Colormap Mode operator. If an improper colormap mode is chosen, your output might not turn out as you expected.
This tool does not honor the Output extent environment setting for enterprise geodatabases. If you want a specific extent for your output raster, consider using the Clip tool. You can either clip the input rasters prior to using this tool, or clip the output of this tool.
Syntax
MosaicToNewRaster(input_rasters, output_location, raster_dataset_name_with_extension, {coordinate_system_for_the_raster}, {pixel_type}, {cellsize}, number_of_bands, {mosaic_method}, {mosaic_colormap_mode})
Parameter | Explanation | Data Type |
input_rasters [input_raster,...] | The raster datasets that you want to merge together. The inputs must have the same number of bands and same bit depth. | Composite Layer; Mosaic Dataset; Raster Dataset; Raster Layer |
output_location | The path to contain the raster dataset. The path can be to a folder or geodatabase. | Workspace; Raster Catalog |
raster_dataset_name_with_extension | The name of the dataset you are creating. When storing the raster dataset in a file format, you need to specify the file extension:
When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a Compression Type and Compression Quality in the geoprocessing Environments. | String |
coordinate_system_for_the_raster (Optional) | The coordinate system for the output raster dataset. If this is not specified, the Output Coordinate System environment setting will be used. | Coordinate System |
pixel_type (Optional) | The bit depth, or radiometric resolution of the mosaic dataset. If you do not set the pixel type, the 8-bit default will be used and your output may be incorrect.
| String |
cellsize (Optional) | The cell size for the new raster dataset. | Double |
number_of_bands | The number of bands that the output raster will have. | Long |
mosaic_method (Optional) | The method used to mosaic overlapping areas.
For more information about each mosaic operator, refer to Mosaic Operator. | String |
mosaic_colormap_mode (Optional) | Applies when the input raster datasets have a colormap. The method used to choose which color map from the input rasters will be applied to the mosaic output.
| String |
Derived Output
Name | Explanation | Data Type |
output_raster_dataset | The output raster dataset. | Raster Dataset |
Code sample
MosaicToNewRaster example 1 (Python window)
This is a Python sample for the MosaicToNewRaster tool.
import arcpy
from arcpy import env
env.workspace = "c:/data"
arcpy.MosaicToNewRaster_management("land1.tif;land2.tif", "Mosaic2New", \
"landnew.tif", "World_Mercator.prj",\
"8_BIT_UNSIGNED", "40", "1", "LAST","FIRST")
MosaicToNewRaster example 2 (stand-alone script)
This is a Python script sample for the MosaicToNewRaster tool.
##==================================
##Mosaic To New Raster
##Usage: MosaicToNewRaster_management inputs;inputs... output_location raster_dataset_name_with_extension
## {coordinate_system_for_the_raster} 8_BIT_UNSIGNED | 1_BIT | 2_BIT | 4_BIT
## | 8_BIT_SIGNED | 16_BIT_UNSIGNED | 16_BIT_SIGNED | 32_BIT_FLOAT | 32_BIT_UNSIGNED
## | 32_BIT_SIGNED | | 64_BIT {cellsize} number_of_bands {LAST | FIRST | BLEND | MEAN
## | MINIMUM | MAXIMUM} {FIRST | REJECT | LAST | MATCH}
import arcpy
arcpy.env.workspace = r"\\MyMachine\PrjWorkspace\RasGP"
##Mosaic several TIFF images to a new TIFF image
arcpy.MosaicToNewRaster_management("landsatb4a.tif;landsatb4b.tif","Mosaic2New", "landsat.tif", "World_Mercator.prj",\
"8_BIT_UNSIGNED", "40", "1", "LAST","FIRST")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes