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.
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, or a 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 folder or geodatabase to store the raster. | Workspace |
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. | 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 the Mosaic Operator help topic. | 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
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")
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
- Extent
Not valid for enterprise geodatabase
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes