Mosaic To New Raster (Data Management)

License Level:BasicStandardAdvanced

Summary

Mosaics multiple raster datasets into a new raster dataset.

Usage

Syntax

MosaicToNewRaster_management (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})
ParameterExplanationData Type
input_rasters
[input_raster,...]

The input raster datasets.

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 and extension of the raster dataset to be created.

When storing the raster dataset in a file format, you need to specify the file extension:

  • .bil—Esri BIL
  • .bip—Esri BIP
  • .bmp—BMP
  • .bsq—Esri 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, no file extension should be added 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.

String
coordinate_system_for_the_raster
(Optional)

Specifies the map projection of the output raster mosaic.

Coordinate System
pixel_type
(Optional)

Specifies the bit depth of the output raster dataset.

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.

  • 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 to be contained by the raster dataset.

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

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

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

String

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

Environments

Extent

Not valid for ArcSDE

Related Topics

Licensing Information

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