Add Rasters To Mosaic Dataset (Data Management)

Summary

Adds raster datasets to a mosaic dataset from various sources, including a file, folder, table, or web service.

Usage

  • Raster data that is added is not managed; if the raster data is deleted or moved, the mosaic dataset will be affected.

  • You can only add rasters to a mosaic dataset contained in a geodatabase. Those created outside a geodatabase can only contain the contents of a previously created mosaic dataset.

  • The Raster Type parameter identifies metadata required for loading data into the mosaic dataset.

    Learn more about raster types

    The raster type is specific to imagery products. It identifies metadata—such as georeferencing, acquisition date, and sensor type—along with a raster format.

  • The Raster Type Properties page contains information about the supported product types and processing templates based on the selected raster type. You can define various other properties such as Stretch, Gamma, Orthorectification, Band Combination, and Pansharpening types based on the analysis and the data being used.

  • The Processing Templates drop-down list includes functions that will be applied to items that will be added to the mosaic dataset and how, or in what order, they will be applied.

  • For faster display and processing, the pixel cache for a mosaic dataset can be generated when the Enable Pixel Cache parameter is checked.

Parameters

LabelExplanationData Type
Mosaic Dataset

The path and name of the mosaic dataset to which the raster data will be added.

Mosaic Layer
Raster Type

The type of raster that will be added. The raster type is specific to imagery products. It identifies metadata—such as georeferencing, acquisition date, and sensor type—along with a raster format.

If you are using a LAS, LAS Dataset, or Terrain raster type, a cell size must be specified on the Raster Type properties page.

The Processing Templates drop-down list contains functions that will be applied to items that are added to the mosaic dataset and how, or in what order, they will be applied. You can use a single function, such as the Stretch function, or you can chain multiple functions together to create a more advanced product. Most raster types have several preexisting functions associated with them. Use this drop-down list to edit existing functions or add new functions to items that will be added to the mosaic dataset.

  • To edit a template, select it in the Processing Templates drop-down list, and click Edit Raster Function Edit Raster Function. Once you finish editing the template, click Save Save As to update the template, or click Save As Save As to save it as a new item in the drop-down list. To export a template to disk for use with other mosaic datasets, click the Export button Export.
  • To create a template, click Create New Raster FunctionTemplate Create New Raster Function Template in the Processing Templates drop-down list. For more information, see Raster function template.
  • To import a function chain from disk or from the Raster Function pane, click Import Generic Import_Generic in the Processing Templates drop-down list. If the template was created independently of the raster type template editor, you need to change the name of the primary input raster variable to Dataset. To do this, double-click the first function in the chain and click the Variables tab. Change the value in the Name field of the raster parameter to Dataset.
Raster Type
Input Data

Specifies the path and name of the input file, folder, raster dataset, mosaic dataset, table, or service.

Not all input options will be available. The selected raster type determines the available options.

  • DatasetAn ArcGIS geographic dataset, such as a raster or mosaic dataset in a geodatabase or table, will be used as input.
  • WorkspaceA folder containing multiple raster datasets will be used as input. The folder can contain subfolders.This option is affected by the Include Sub Folders and Input Data Filter parameters.
  • FileOne or more raster datasets stored in a folder on disk, an image service definition file (.ISDef), or a raster process definition file (.RPDef) will be used as input. Files that do not correspond to the raster type being added will be ignored. Do not use this option with file formats that are raster datasets, such as TIFF or MrSID files; use the Dataset option instead.
  • ServiceA WCS, a map, an image service, or a web service layer file will be used as input.
File; Image Service; LAS Dataset Layer; Layer File; Map Server; Mosaic Layer; Raster Layer; Table View; Terrain Layer; WCS Coverage; WMS Map; Workspace
Update Cell Size Ranges
(Optional)

Specifies whether the cell size ranges of each raster in the mosaic dataset will be calculated. These values will be written to the attribute table in the minPS and maxPS fields.

  • Checked—The cell size ranges will be calculated for all the rasters in the mosaic dataset. This is the default.
  • Unchecked—The cell size ranges will not be calculated.
Boolean
Update Boundary
(Optional)

Specifies whether the boundary polygon of a mosaic dataset will be generated or updated. By default, the boundary merges all the footprint polygons to create a single boundary representing the extent of the valid pixels.

  • Checked—The boundary will be generated or updated. This is the default.
  • Unchecked—The boundary will not be generated or updated.
Boolean
Update Overviews
(Optional)

Specifies whether overviews for a mosaic dataset will be defined and generated.

  • Checked—Overviews will be defined and generated.
  • Unchecked—Overviews will not be defined or generated. This is the default.
Boolean
Maximum Levels
(Optional)

The maximum number of pyramid levels that will be used in the mosaic dataset. For example, a value of 2 will use only the first two pyramid levels from the source raster. Leaving this parameter blank or typing a value of -1 will build pyramids for all levels.

This value can affect the display and number of overviews that will be generated.

Long
Maximum Cell Size
(Optional)

The maximum pyramid cell size that will be used in the mosaic dataset.

Double
Minimum Rows or Columns
(Optional)

The minimum dimensions of a raster pyramid that will be used in the mosaic dataset.

Long
Coordinate System for Input Data
(Optional)

The spatial reference system of the input data.

This should be specified if the data does not have a coordinate system; otherwise, the coordinate system of the mosaic dataset will be used. This can also be used to override the coordinate system of the input data.

Spatial Reference
Input Data Filter
(Optional)

A filter for the data being added to the mosaic dataset. You can use SQL expressions to create the data filter. The wildcards for the filter work on the full path to the input data.

The following SQL statement will select the rows in which the following object IDs match:

  • OBJECTID IN (19745, 19680, 19681, 19744, 5932, 5931, 5889, 5890, 14551, 14552, 14590, 14591)

To add only a TIFF image, add an asterisk before a file extension.

  • *.TIF

To add an image with the word sensor in the file path or file name, add an asterisk before and after the word sensor.

  • *sensor2009*

You can also use PERL syntax to create a data filter.

  • REGEX:.*1923.*|.*1922.*

  • REGEX:.*192[34567].*|.*194.*|.*195.*

The following PERL syntax with multiple lexical groupings as part of the expression is not supported:

  • REGEX:.* map_mean_.*(?:(?:[a-z0-9]*)_pptPct_(?:[0-9]|1[0-2]*?)_2[0-9]_*\w*).img

Alternatively, you can use the following syntax:

  • REGEX:.*map_mean_*[a-z0-9]*_pptPct_([0-9]|1[0-2])_2[0-9]*_\w*.img

String
Include Sub Folders
(Optional)

Specifies whether subfolders will be recursively explored.

  • Checked—All subfolders will be explored for data. This is the default.
  • Unchecked—Only the top-level folder will be explored for data.
Boolean
Add New Datasets Only
(Optional)

Specifies how duplicate rasters will be handled. A check will be performed to determine whether each raster has already been added, using the original path and file name. Choose the action to be performed when a duplicate path and file name are found.

  • Allow duplicatesAll rasters will be added even if they already exist in the mosaic dataset. This is the default.
  • Exclude duplicatesDuplicate rasters will not be added.
  • Overwrite duplicatesDuplicate rasters will overwrite existing rasters.
String
Build Raster Pyramids
(Optional)

Specifies whether pyramids will be built for each source raster.

  • Unchecked—Pyramids will not be built. This is the default.
  • Checked—Pyramids will be built.
Boolean
Calculate Statistics
(Optional)

Specifies whether statistics will be calculated for each source raster.

  • Unchecked—Statistics will not be calculated. This is the default.
  • Checked—Statistics will be calculated.
Boolean
Build Thumbnails
(Optional)

Specifies whether thumbnails will be built for each source raster.

  • Unchecked—Thumbnails will not be built. This is the default.
  • Checked—Thumbnails will be built.
Boolean
Operation Description
(Optional)

The description used to represent the operation of adding raster data. It will be added to the raster type table, which can be used as part of a search or as a reference at another time.

String
Force this Coordinate System for Input Data
(Optional)

Specifies whether the Coordinate System for Input Data parameter value will be used for all the rasters when loading data into the mosaic dataset. This parameter does not reproject the data; it uses the coordinate system defined in the tool to construct items in the mosaic dataset. The extent of the image will be used, but the projection will be overwritten.

  • Unchecked—The coordinate system of each raster data will be used when loading data. This is the default. If unchecked and the input image does not have a coordinate system (that is, it's unknown), the mosaic dataset coordinate system will be used in constructing mosaic dataset items. If the image has a coordinate system, that coordinate system will be used.
  • Checked—The coordinate system specified in the Coordinate System for Input Data parameter will be used for each raster dataset when loading data.
Boolean
Estimate Mosaic Dataset Statistics
(Optional)

Specifies whether statistics will be estimated on the mosaic dataset for faster rendering and processing at the mosaic dataset level.

  • Unchecked—Statistics will not be estimated. Statistics generated from each item in the mosaic dataset will be used for display and processing. This is the default.
  • Checked—Statistics will be estimated at the mosaic dataset level. This will use the distribution of pixels to display the mosaic dataset rather than the distribution of the source item in the mosaic dataset.
Boolean
Auxiliary Inputs
(Optional)

The raster type settings that will be defined on the Raster Type Properties page. This parameter will override the settings defined on the Raster Type Properties page. Auxiliary input options include the following:

  • CameraFile—A .cam or .csv file that stores the camera model information, such as the focal length, sensor pixel size, columns, rows and similar attributes.
  • CameraProperties—A JSON string that defines the camera model.
  • ConstantZ—A value, in meters, that is used to provide an initial estimate of the flight height for each image.
  • CorrectGeoid—A value of 0 represents false, and a value of 1 represents true. This option is only available when a DEM is used.
  • DEM—A DEM used to provide an initial estimate of the flight height for each image.
  • EstimateFlightHeight—An estimated flight height which can be directly used to compute footprint and estimate photo scale.
  • GPSAltRef—Define the altitude used as the reference altitude. 0 indicates above sea level, and 1 is below sea level.
  • GPSFile—A GPS text file, such as a comma-separated value file (.csv), which includes values for the Image Name, Latitude, Longitude, and Altitude fields, and optionally, the Omega, Phi, and Kappa fields. The geolocation file is provided by the supplier along with the drone imagery.
  • GPSLatRef—Define whether the latitude is north or south latitude. N indicates north latitude, and S is south latitude.
  • GPSLonRef—Define whether the longitude is east or west longitude. E indicates east longitude, and W is west longitude.
  • GPSSRS—Define the spatial reference of the GPS.
  • GPSVCS—Define the vertical coordinate system of the GPS.
  • IsAltitudeFlightHeight—A Boolean value defines whether the drone reports heights relative to the takeoff point, or altitude for heights relative to a vertical datum. Use a value of 0 when the altitude value is altitude above a datum, and a value of 1 when the altitude value is flight height from a takeoff point.
  • MinimumFlightHeight—Define the minimum flight height. If the estimated flight height of an image is smaller than this number, the image will be considered invalid and will not be added to the image collection for future processing.
  • ZFactor—The scaling factor used to convert the elevation values. This option is only available when using a DEM.
  • ZOffset—The base value to be added to the elevation value in the DEM. This can be used to offset elevation values that do not start at sea level. This option is only available when using a DEM.

Value Table
Enable Pixel Cache
(Optional)

Specifies whether the pixel cache will be generated for faster display and processing of the mosaic dataset.

  • Unchecked—The pixel cache will not be generated. This is the default.
  • Checked—The pixel cache will be generated.
Boolean
Pixel Cache Location
(Optional)

The location of the pixel cache. If no location is defined, the cache will be written to C:\Users\<Username>\AppData\Local\ESRI\rasterproxies\.

Once the location is defined, you do not need to redefine the path when adding new rasters to the mosaic dataset. You do need to check the Enable Pixel Cache parameter (enable_pixel_cache = "USE_PIXEL_CACHE" in Python) when adding the new data.

Folder; String

Derived Output

LabelExplanationData Type
Updated Mosaic Dataset

The updated mosaic dataset.

Mosaic Layer

arcpy.management.AddRastersToMosaicDataset(in_mosaic_dataset, raster_type, input_path, {update_cellsize_ranges}, {update_boundary}, {update_overviews}, {maximum_pyramid_levels}, {maximum_cell_size}, {minimum_dimension}, {spatial_reference}, {filter}, {sub_folder}, {duplicate_items_action}, {build_pyramids}, {calculate_statistics}, {build_thumbnails}, {operation_description}, {force_spatial_reference}, {estimate_statistics}, {aux_inputs}, {enable_pixel_cache}, {cache_location})
NameExplanationData Type
in_mosaic_dataset

The path and name of the mosaic dataset to which the raster data will be added.

Mosaic Layer
raster_type

The type of raster that will be added. The raster type is specific to imagery products. It identifies metadata—such as georeferencing, acquisition date, and sensor type—along with a raster format.

If you are using a LAS, LAS Dataset, or Terrain raster type, an .art file must be used when the cell size is specified.

For a list of supported sensors and raster types, see the list of supported sensors.

Raster Type
input_path
[input_path,...]

Specifies the path and name of the input file, folder, raster dataset, mosaic dataset, table, or service.

Not all input options will be available. The selected raster type determines the available options.

  • DatasetAn ArcGIS geographic dataset, such as a raster or mosaic dataset in a geodatabase or table, will be used as input.
  • FolderA folder containing multiple raster datasets will be used as input. The folder can contain subfolders.This option is affected by the Include Sub Folders and Input Data Filter parameters.
  • FileOne or more raster datasets stored in a folder on disk, an image service definition file (.ISDef), or a raster process definition file (.RPDef) will be used as input. Files that do not correspond to the raster type being added will be ignored. Do not use this option with file formats that are raster datasets, such as TIFF or MrSID files; use the Dataset option instead.
  • ServiceA WCS, a map, an image service, or a web service layer file will be used as input.
File; Image Service; LAS Dataset Layer; Layer File; Map Server; Mosaic Layer; Raster Layer; Table View; Terrain Layer; WCS Coverage; WMS Map; Workspace
update_cellsize_ranges
(Optional)

Specifies whether the cell size ranges of each raster in the mosaic dataset will be calculated. These values will be written to the attribute table in the minPS and maxPS fields.

  • UPDATE_CELL_SIZESThe cell size ranges will be calculated for all the rasters in the mosaic dataset. This is the default.
  • NO_CELL_SIZESThe cell size ranges will not be calculated.
Boolean
update_boundary
(Optional)

Specifies whether the boundary polygon of a mosaic dataset will be generated or updated. By default, the boundary merges all the footprint polygons to create a single boundary representing the extent of the valid pixels.

  • UPDATE_BOUNDARYThe boundary will be generated or updated. This is the default.
  • NO_BOUNDARYThe boundary will not be generated or updated.
Boolean
update_overviews
(Optional)

Specifies whether overviews for a mosaic dataset will be defined and generated.

  • UPDATE_OVERVIEWSOverviews will be defined and generated.
  • NO_OVERVIEWSOverviews will not be defined or generated. This is the default.
Boolean
maximum_pyramid_levels
(Optional)

The maximum number of pyramid levels that will be used in the mosaic dataset. For example, a value of 2 will use only the first two pyramid levels from the source raster. Leaving this parameter blank or typing a value of -1 will build pyramids for all levels.

This value can affect the display and number of overviews that will be generated.

Long
maximum_cell_size
(Optional)

The maximum pyramid cell size that will be used in the mosaic dataset.

Double
minimum_dimension
(Optional)

The minimum dimensions of a raster pyramid that will be used in the mosaic dataset.

Long
spatial_reference
(Optional)

The spatial reference system of the input data.

This should be specified if the data does not have a coordinate system; otherwise, the coordinate system of the mosaic dataset will be used. This can also be used to override the coordinate system of the input data.

Spatial Reference
filter
(Optional)

A filter for the data being added to the mosaic dataset. You can use SQL expressions to create the data filter. The wildcards for the filter work on the full path to the input data.

The following SQL statement will select the rows in which the following object IDs match:

  • OBJECTID IN (19745, 19680, 19681, 19744, 5932, 5931, 5889, 5890, 14551, 14552, 14590, 14591)

To add only a TIFF image, add an asterisk before a file extension.

  • *.TIF

To add an image with the word sensor in the file path or file name, add an asterisk before and after the word sensor.

  • *sensor2009*

You can also use PERL syntax to create a data filter.

  • REGEX:.*1923.*|.*1922.*

  • REGEX:.*192[34567].*|.*194.*|.*195.*

The following PERL syntax with multiple lexical groupings as part of the expression is not supported:

  • REGEX:.* map_mean_.*(?:(?:[a-z0-9]*)_pptPct_(?:[0-9]|1[0-2]*?)_2[0-9]_*\w*).img

Alternatively, you can use the following syntax:

  • REGEX:.*map_mean_*[a-z0-9]*_pptPct_([0-9]|1[0-2])_2[0-9]*_\w*.img

String
sub_folder
(Optional)

Specifies whether subfolders will be recursively explored.

  • SUBFOLDERSAll subfolders will be explored for data. This is the default.
  • NO_SUBFOLDERSOnly the top-level folder will be explored for data.
Boolean
duplicate_items_action
(Optional)

Specifies how duplicate rasters will be handled. A check will be performed to determine whether each raster has already been added, using the original path and file name. Choose the action to be performed when a duplicate path and file name are found.

  • ALLOW_DUPLICATESAll rasters will be added even if they already exist in the mosaic dataset. This is the default.
  • EXCLUDE_DUPLICATESDuplicate rasters will not be added.
  • OVERWRITE_DUPLICATESDuplicate rasters will overwrite existing rasters.
String
build_pyramids
(Optional)

Specifies whether pyramids will be built for each source raster.

  • NO_PYRAMIDSPyramids will not be built. This is the default.
  • BUILD_PYRAMIDSPyramids will be built.
Boolean
calculate_statistics
(Optional)

Specifies whether statistics will be calculated for each source raster.

  • NO_STATISTICSStatistics will not be calculated. This is the default.
  • CALCULATE_STATISTICSStatistics will be calculated.
Boolean
build_thumbnails
(Optional)

Specifies whether thumbnails will be built for each source raster.

  • NO_THUMBNAILSThumbnails will not be built. This is the default.
  • BUILD_THUMBNAILSThumbnails will be built.
Boolean
operation_description
(Optional)

The description used to represent the operation of adding raster data. It will be added to the raster type table, which can be used as part of a search or as a reference at another time.

String
force_spatial_reference
(Optional)

Specifies the coordinate system that will be used. Use the coordinate system specified in the spatial_reference parameter for all the rasters when loading data into the mosaic dataset.

  • NO_FORCE_SPATIAL_REFERENCEThe coordinate system of each raster data will be used when loading data. This is the default.
  • FORCE_SPATIAL_REFERENCEThe coordinate system specified in the spatial_reference parameter will be used for each raster when loading data.
Boolean
estimate_statistics
(Optional)

Specifies whether statistics will be estimated on the mosaic dataset for faster rendering and processing at the mosaic dataset level.

  • NO_STATISTICSStatistics will not be estimated. Statistics generated from each item in the mosaic dataset will be used for display and processing. This is the default.
  • ESTIMATE_STATISTICSStatistics will be estimated at the mosaic dataset level. This will use the distribution of pixels to display the mosaic dataset rather than the distribution of the source item in the mosaic dataset.
Boolean
aux_inputs
[aux_inputs,...]
(Optional)

The raster type settings that will be defined on the Raster Type Properties page. This parameter will override the settings defined on the Raster Type Properties page. Auxiliary input options include the following:

  • CameraFile—A .cam or .csv file that stores the camera model information, such as the focal length, sensor pixel size, columns, rows and similar attributes.
  • CameraProperties—A JSON string that defines the camera model.
  • ConstantZ—A value, in meters, that is used to provide an initial estimate of the flight height for each image.
  • CorrectGeoid—A value of 0 represents false, and a value of 1 represents true. This option is only available when a DEM is used.
  • DEM—A DEM used to provide an initial estimate of the flight height for each image.
  • EstimateFlightHeight—An estimated flight height which can be directly used to compute footprint and estimate photo scale.
  • GPSAltRef—Define the altitude used as the reference altitude. 0 indicates above sea level, and 1 is below sea level.
  • GPSFile—A GPS text file, such as a comma-separated value file (.csv), which includes values for the Image Name, Latitude, Longitude, and Altitude fields, and optionally, the Omega, Phi, and Kappa fields. The geolocation file is provided by the supplier along with the drone imagery.
  • GPSLatRef—Define whether the latitude is north or south latitude. N indicates north latitude, and S is south latitude.
  • GPSLonRef—Define whether the longitude is east or west longitude. E indicates east longitude, and W is west longitude.
  • GPSSRS—Define the spatial reference of the GPS.
  • GPSVCS—Define the vertical coordinate system of the GPS.
  • IsAltitudeFlightHeight—A Boolean value defines whether the drone reports heights relative to the takeoff point, or altitude for heights relative to a vertical datum. Use a value of 0 when the altitude value is altitude above a datum, and a value of 1 when the altitude value is flight height from a takeoff point.
  • MinimumFlightHeight—Define the minimum flight height. If the estimated flight height of an image is smaller than this number, the image will be considered invalid and will not be added to the image collection for future processing.
  • ZFactor—The scaling factor used to convert the elevation values. This option is only available when using a DEM.
  • ZOffset—The base value to be added to the elevation value in the DEM. This can be used to offset elevation values that do not start at sea level. This option is only available when using a DEM.

Value Table
enable_pixel_cache
(Optional)

Specifies whether the pixel cache will be generated for faster display and processing of the mosaic dataset.

  • NO_PIXEL_CACHEThe pixel cache will not be generated. This is the default.
  • USE_PIXEL_CACHEThe pixel cache will be generated.
Boolean
cache_location
(Optional)

The location of the pixel cache. If no location is defined, the cache will be written to C:\Users\<Username>\AppData\Local\ESRI\rasterproxies\.

Once the location is defined, you do not need to redefine the path when adding new rasters to the mosaic dataset. You do need to check the Enable Pixel Cache parameter (enable_pixel_cache = "USE_PIXEL_CACHE" in Python) when adding the new data.

Folder; String

Derived Output

NameExplanationData Type
out_mosaic_dataset

The updated mosaic dataset.

Mosaic Layer

Code sample

AddRastersToMosaicDataset example 1 (Python window)

This is a Python sample for the AddRastersToMosaicDataset function.

import arcpy
arcpy.management.AddRastersToMosaicDataset(
     "c:/data/AddMD.gdb/md_landsat", "Landsat 7 ETM+", 
     "c:/data/landsat7etm", "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY",
     "UPDATE_OVERVIEWS", "2", "#", "#", "GCS_WGS_1984.prj",
     "*.tif", "SUBFOLDERS", "EXCLUDE_DUPLICATES",
     "NO_PYRAMIDS", "NO_STATISTICS", "BUILD_THUMBNAILS", 
     "Add Landsat L1G", "FORCE_SPATIAL_REFERENCE",
     "NO_STATISTICS", "", "USE_PIXEL_CACHE", 
r"C:\test\cachelocation")
AddRastersToMosaicDataset example 2 (stand-alone script)

This is a Python script sample for the AddRastersToMosaicDataset function.

#Add Raster Dataset type Raster to FGDB Mosaic Dataset
#Calculate Cell Size Ranges and Build Boundary
#Build Overviews for Mosaic Dataset upon the 3rd level Raster Dataset pyramid
#Apply TIFF file filter
#Build Pyramids for the source datasets

import arcpy
arcpy.env.workspace = "C:/Workspace"

    
mdname = "AddMD.gdb/md_rasds"
rastype = "Raster Dataset"
inpath = "c:/data/rasds"
updatecs = "UPDATE_CELL_SIZES"
updatebnd = "UPDATE_BOUNDARY"
updateovr = "UPDATE_OVERVIEWS"
maxlevel = "2"
maxcs = "#"
maxdim = "#"
spatialref = "#"
inputdatafilter = "*.tif"
subfolder = "NO_SUBFOLDERS"
duplicate = "EXCLUDE_DUPLICATES"
buildpy = "BUILD_PYRAMIDS"
calcstats = "CALCULATE_STATISTICS"
buildthumb = "NO_THUMBNAILS"
comments = "Add Raster Datasets"
forcesr = "#"
estimatestats = "ESTIMATE_STATISTICS"
auxilaryinput = ""
enablepixcache = "USE_PIXEL_CACHE"
cachelocation = "c:\\test\\cachelocation"

arcpy.management.AddRastersToMosaicDataset(
     mdname,  rastype, inpath, updatecs, updatebnd, updateovr,
     maxlevel, maxcs, maxdim, spatialref, inputdatafilter,
     subfolder, duplicate, buildpy, calcstats, 
     buildthumb, comments, forcesr, estimatestats,
     auxilaryinput, enablepixcache, cachelocation)