Mosaic To New Raster (Data Management)

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 mosaic. In this situation, use the Mosaic tool for rasters with different color maps; however, you must choose the proper Mosaic Colormap Mode parameter value. If an improper colormap mode is chosen, your output may not be as 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.

Parameters

LabelExplanationData Type
Input Rasters

The raster datasets that you want to merge together. The inputs must have the same number of bands and same bit depth.

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:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • No extension for Esri Grid

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
Spatial Reference for 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.

  • 1 bitA 1-bit unsigned integer. The values can be 0 or 1.
  • 2 bitA 2-bit unsigned integer. The values supported can be from 0 to 3.
  • 4 bitA 4-bit unsigned integer. The values supported can be from 0 to 15.
  • 8 bit unsignedAn unsigned 8-bit data type. The values supported can be from 0 to 255.
  • 8 bit signedA signed 8-bit data type. The values supported can be from -128 to 127.
  • 16 bit unsignedA 16-bit unsigned data type. The values can range from 0 to 65,535.
  • 16 bit signedA 16-bit signed data type. The values can range from -32,768 to 32,767.
  • 32 bit unsignedA 32-bit unsigned data type. The values can range from 0 to 4,294,967,295.
  • 32 bit signedA 32-bit signed data type. The values can range from -2,147,483,648 to 2,147,483,647.
  • 32 bit floatA 32-bit data type supporting decimals.
  • 64 bitA 64-bit data type supporting decimals.
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 Operator
(Optional)

The method used to mosaic overlapping areas.

For more information about each mosaic operator, refer to 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)

Applies when the input raster datasets have a colormap.

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

Derived Output

LabelExplanationData Type
Output Raster Dataset

The output raster dataset.

Raster Dataset

arcpy.management.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})
NameExplanationData 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.

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:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • No extension for Esri Grid

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.

  • 1_BITA 1-bit unsigned integer. The values can be 0 or 1.
  • 2_BITA 2-bit unsigned integer. The values supported can be from 0 to 3.
  • 4_BITA 4-bit unsigned integer. The values supported can be from 0 to 15.
  • 8_BIT_UNSIGNEDAn unsigned 8-bit data type. The values supported can be from 0 to 255.
  • 8_BIT_SIGNEDA signed 8-bit data type. The values supported can be from -128 to 127.
  • 16_BIT_UNSIGNEDA 16-bit unsigned data type. The values can range from 0 to 65,535.
  • 16_BIT_SIGNEDA 16-bit signed data type. The values can range from -32,768 to 32,767.
  • 32_BIT_UNSIGNEDA 32-bit unsigned data type. The values can range from 0 to 4,294,967,295.
  • 32_BIT_SIGNEDA 32-bit signed data type. The values can range from -2,147,483,648 to 2,147,483,647.
  • 32_BIT_FLOATA 32-bit data type supporting decimals.
  • 64_BITA 64-bit data type supporting decimals.
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.

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

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.

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

Derived Output

NameExplanationData 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")

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics