ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS 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
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Add Rasters To Mosaic Dataset

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

Summary

Adds raster datasets to a mosaic dataset from many 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 raster catalog or previously created mosaic dataset.

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

    Learn more about raster types

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

Syntax

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})
ParameterExplanationData 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 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 raster types, see the list of supported raster and image data formats.

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.

  • Dataset —An ArcGIS geographic dataset, such as a raster or mosaic dataset in a geodatabase or table, will be used as input.
  • Workspace —A 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.
  • File —One 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.The file list will ignore files that do not correspond to the raster type being added. Do not use this option with file formats that are raster datasets, such as TIFF or MrSID files; use Dataset.
  • Service —A 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 Catalog 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 are written to the attribute table in the minPS and maxPS fields.

  • UPDATE_CELL_SIZES —The cell size ranges will be calculated for all the rasters in the mosaic dataset. This is the default.
  • NO_CELL_SIZES —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.

  • UPDATE_BOUNDARY —The boundary will be generated or updated. This is the default.
  • NO_BOUNDARY —The boundary will not be generated or updated.
Boolean
update_overviews
(Optional)

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

  • UPDATE_OVERVIEWS —Overviews will be defined and generated.
  • NO_OVERVIEWS —Overviews 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.

  • SUBFOLDERS —All subfolders will be explored for data. This is the default.
  • NO_SUBFOLDERS —Only 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_DUPLICATES —All rasters will be added even if they already exist in the mosaic dataset. This is the default.
  • EXCLUDE_DUPLICATES —The duplicate raster will not be added.
  • OVERWRITE_DUPLICATES —The duplicate raster will overwrite the existing raster.
String
build_pyramids
(Optional)

Builds pyramids for each source raster.

  • NO_PYRAMIDS —Pyramids will not be built. This is the default.
  • BUILD_PYRAMIDS —Pyramids will be built.
Boolean
calculate_statistics
(Optional)

Specifies whether statistics will be calculated for each source raster.

  • NO_STATISTICS —Statistics will not be calculated. This is the default.
  • CALCULATE_STATISTICS —Statistics will be calculated.
Boolean
build_thumbnails
(Optional)

Specifies whether thumbnails will be built for each source raster.

  • NO_THUMBNAILS —Thumbnails will not be built. This is the default.
  • BUILD_THUMBNAILS —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_spatial_reference
(Optional)

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

  • NO_FORCE_SPATIAL_REFERENCE —The coordinate system of each raster data will be used when loading data. This is the default.
  • FORCE_SPATIAL_REFERENCE —The 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_STATISTICS —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.
  • ESTIMATE_STATISTICS —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
aux_inputs
[aux_inputs,...]
(Optional)

The raster type settings that will be defined on the Raster Type Properties page. The settings in this parameter will override the settings defined on the Raster Type Properties page.

Value Table

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.AddRastersToMosaicDataset_management(
     "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 = "#"

arcpy.AddRastersToMosaicDataset_management(
     mdname,  rastype, inpath, updatecs, updatebnd, updateovr,
     maxlevel, maxcs, maxdim, spatialref, inputdatafilter,
     subfolder, duplicate, buildpy, calcstats, 
     buildthumb, comments, forcesr)

Environments

  • Current Workspace
  • Extent
  • Geographic Transformations
  • Parallel Processing Factor
  • Pyramid
  • Raster Statistics
  • Scratch Workspace

Licensing information

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

Related topics

  • An overview of the Raster toolset
  • Environment settings for raster data
  • What is a raster type?
  • Supported raster dataset file formats
  • Adding raster data to a mosaic dataset
  • List of supported raster and image data formats

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal