Add Rasters To Mosaic Dataset (Data Management)


Adds raster datasets to a mosaic dataset from many sources, including a file, folder, raster catalog, table, or Web service.



AddRastersToMosaicDataset_management (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})
ParameterExplanationData Type

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

Mosaic Dataset; Mosaic Layer

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

For a list of default raster types, please refer to Supported raster types.

Raster Type

Path and name of the file, folder, raster dataset, raster catalog, mosaic dataset, table, or service.

  • FileAllows you to select one or more raster datasets stored in a folder on disk, an image service definition (.ISDef) file, and a raster process definition (.RPDef) file.
  • WorkspaceAllows you to select a folder containing multiple raster datasets. The folder can contain subfolders.This is affected by the Include Sub Folders and Filter parameters.
  • DatasetAllows you to select an ArcGIS geographic dataset, such as any raster, raster catalog, or mosaic dataset in a geodatabase, or a table.
  • ServiceAllows you to select a WCS, map, or image service, or a Web service layer file.
File; Workspace; Raster Dataset; Mosaic Dataset; Table; Raster Layer; Raster Catalog Layer; Mosaic Layer; WCS Coverage; Image Service; MapServer

Calculates the cell size ranges of each raster in the mosaic dataset. These values are written to the attribute table within the minPS and maxPS columns.

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

Generates or updates the boundary polygon of a mosaic dataset. 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.

Defines and generates overviews for a mosaic dataset.

  • UPDATE_OVERVIEWSOverviews will be defined and generated.
  • NO_OVERVIEWSOverviews will not be defined or generated. This is the default.

Defines 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 blank or typing a value of -1 will build pyramids for all levels.

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


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


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


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

A file name filter for the data being added to the mosaic dataset. The wildcards for the filter can be a simple asterisk before a file extension, or it can be formatted using the PERL syntax.

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

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


Recursively explores subfolders.

  • SUBFOLDERSAll subfolders will be explored for data. This is the default.
  • NO_SUBFOLDERSOnly the top-level folder will be explored for data.

A check will be performed to see if each raster has already been added, using the original path and file name. Choose which action to perform when a duplicate path and file name have been found.

  • ALLOW_DUPLICATESAll rasters will be added even if they already exist within the mosaic dataset. This is the default.
  • EXCLUDE_DUPLICATESThe duplicate raster will not be added.
  • OVERWRITE_DUPLICATESThe duplicate raster will overwrite the existing one.

Builds pyramids for each source raster.

  • NO_PYRAMIDSPyramids will not be generated. This is the default.
  • BUILD_PYRAMIDSPyramids will be generated.

Calculates statistics for each source raster.

  • NO_STATISTICSStatistics will not be generated. This is the default.
  • CALCULATE_STATISTICSStatistics will be generated.

Builds thumbnails for each source raster.

  • NO_THUMBNAILSThumbnails will not be generated. This is the default.
  • BUILD_THUMBNAILSThumbnails will be generated.

Code Sample

AddRastersToMosaicDataset example 1 (Python window)

This is a Python sample for the AddRastersToMosaicDataset tool.

import arcpy
arcpy.AddRasters_management("c:/workspace/AddMD.gdb/md01", "Raster Dataset",\
                            "c:/data", "CALCULATE_CELL_SIZES", "BUILD_BOUNDARY",\                                            "BUILD_OVERVIEWS", "#", "#", "#",\
                            "World_Mercator.prj", ".tif", "NO_SUBFOLDERS",\
                            "EXCLUDE_DUPLICATES", "BUILD_PYRAMIDS",\
                            "CALCULATE_STATISTICS", "NO_THUMBNAILS", "Add Rasters")
AddRastersToMosaicDataset example 2 (stand-alone script)

This is a Python script sample for the AddRastersToMosaicDataset tool.

##Add Rasters To Mosaic Dataset
##Usage: AddRastersToMosaicDataset_management in_mosaic_dataset raster_type input_path 
##                             {UPDATE_CELL_SIZES | NO_CELL_SIZES} {UPDATE_BOUNDARY
##                             | NO_BOUNDARY} {NO_OVERVIEWS | UPDATE_OVERVIEWS} 
##                             {maximum_pyramid_levels} {maximum_cell_size} 
##                             {minimum_dimension} {spatial_reference} {filter}
##                             {SUBFOLDERS | NO_SUBFOLDERS} {ALLOW_DUPLICATES
##                             | EXCLUDE_DUPLICATES | OVERWRITE_DUPLICATES}
##                             {NO_PYRAMIDS | BUILD_PYRAMIDS}
##                             | BUILD_THUMBNAILS} {operation_description}
    import arcpy
    arcpy.env.workspace = r"C:\Workspace"
    ##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
    ##Force Spatial Reference to World_Mercator
    ##Apply TIFF file filter
    ##Build Pyramids for the source datasets
    arcpy.AddRastersToMosaicDataset_management("AddMD.gdb/md_rasds", "Raster Dataset", "rasds",\
                                "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "UPDATE_OVERVIEWS",\
                                "2", "#", "#", "World_Mercator.prj", ".tif", "NO_SUBFOLDERS",\
                                "NO_THUMBNAILS", "Add Raster Datasets")
    ##Add Landsat sensor type data to FGDB Mosaic Dataset
    ##Specify the Sensor template as Pansharpened
    ##Use Raster Dataset pyramid up to the cell size of 16
    ##Force Spatial Reference to GCS_WCS_1984
    ##Build Thumbnail for the Mosaic Dataset
    arcpy.AddRastersToMosaicDataset_management("AddMD.gdb/md_landsat","Landsat", "landsat", "UPDATE_CELL_SIZES",\
                                "UPDATE_BOUNDARY", "NO_OVERVIEWS", "#", "16", "#",\
                                "GCS_WGS_1984.prj", "#", "SUBFOLDERS", "EXCLUDE_DUPLICATES",\
                                "NO_PYRAMIDS", "NO_STATISTICS", "BUILD_THUMBNAILS",\
                                "Add Landsat L1G")
    ##Create SDE Mosaic Dataset
    arcpy.AddRastersToMosaicDataset_management("SDE94.sde/TOOLBOX.md_qb","QuickBird", "qb", "UPDATE_CELL_SIZES",\
                                "UPDATE_BOUNDARY", "NO_OVERVIEWS", "#", "#", "#",\
                                "GCS_WGS_1984.prj", "#", "SUBFOLDERS", "EXCLUDE_DUPLICATES",\
                                "NO_PYRAMIDS", "NO_STATISTICS", "BUILD_THUMBNAILS",\
                                "Add QuickBird")
    print "Add Rasters To Mosaic Dataset example failed."
    print arcpy.GetMessages()


Related Topics

Licensing Information

ArcView: No
ArcEditor: Yes
ArcInfo: Yes