ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Mosaic To New Raster

  • Summary
  • Usage
  • Syntax
  • Code sample
  • Environments
  • Licensing information

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, 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 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 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_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 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:

  • .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, 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 Environment Settings.

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.

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

  • FIRST —The color map from the first raster dataset in the list will be applied to the output raster mosaic. This is the default.
  • LAST —The color map from the last raster dataset in the list will be applied to the output raster mosaic.
  • MATCH —Will 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.
  • REJECT —Only the raster datasets that do not have a color map associated with them will be mosaicked.
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}                               

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

  • Current Workspace
  • Output CONFIG Keyword
  • Output Coordinate System
  • Compression
  • Pyramid
  • Raster Statistics
  • Tile Size
  • Extent
    Note:

    Not valid for enterprise geodatabase

  • Scratch Workspace
  • Resampling Method
  • NoData

Licensing information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related topics

  • An overview of the Raster toolset
  • Environment settings for raster data
  • What is a mosaic?
  • What mosaicking tools are available in ArcGIS?
  • Mosaic operators
  • Options when mosaicking with colormaps
  • Using the Mosaic button on the Image Analysis window
  • Color correcting raster data

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal