Mosaic To New Raster (Data Management)
Summary
Mosaics 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, 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 within the Environment Settings.
-
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 ArcSDE. 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
Parameter | Explanation | Data 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:
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.
| 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.
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.
For more information about each colormap mode, refer to Mosaic colormap mode. | String |
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}
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