Add Rasters To Mosaic Dataset (Data Management)
Summary
Adds raster datasets to a mosaic dataset from many sources, including a file, folder, raster catalog, table, or Web service.
Usage
-
Raster data that is added is unmanaged; therefore, if the raster data is deleted or moved the mosaic dataset will be affected.
-
You can only add rasters to a mosaic dataset contained within a geodatabase. Those created outside a geodatabase can only contain the contents of a raster catalog or previously created mosaic dataset.
The raster type identifies metadata required for loading data into the mosaic dataset. ArcGIS supports many default raster types, which are listed in Supported raster types.
Syntax
Parameter | Explanation | Data Type |
in_mosaic_dataset |
The path and name of the mosaic dataset to which the raster data will be added. | Mosaic Dataset; Mosaic Layer |
raster_type | 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 |
input_path [input_path,...] |
Path and name of the file, folder, raster dataset, raster catalog, mosaic dataset, table, or service.
| File; Workspace; Raster Dataset; Mosaic Dataset; Table; Raster Layer; Raster Catalog Layer; Mosaic Layer; WCS Coverage; Image Service; MapServer |
update_cellsize_ranges (Optional) |
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.
| Boolean |
update_boundary (Optional) |
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.
| Boolean |
update_overviews (Optional) |
Defines and generates overviews for a mosaic dataset.
| Boolean |
maximum_pyramid_levels (Optional) |
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. | Long |
maximum_cell_size (Optional) |
Defines the maximum pyramid cell size that will be used in the mosaic dataset. | Double |
minimum_dimension (Optional) |
Defines the minimum dimensions of a raster pyramid that will be used in the mosaic dataset. | Long |
spatial_reference (Optional) |
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 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.
| String |
sub_folder (Optional) |
Recursively explores subfolders.
| Boolean |
duplicate_items_action (Optional) |
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.
| Boolean |
build_pyramids (Optional) |
Builds pyramids for each source raster.
| Boolean |
calculate_statistics (Optional) |
Calculates statistics for each source raster.
| Boolean |
build_thumbnails (Optional) |
Builds thumbnails for each source raster.
| Boolean |
operation_description (Optional) | String |
Code Sample
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")
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} ## {NO_STATISTICS | CALCULATE_STATISTICS} {NO_THUMBNAILS ## | BUILD_THUMBNAILS} {operation_description} try: 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",\ "EXCLUDE_DUPLICATES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS",\ "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") except: print "Add Rasters To Mosaic Dataset example failed." print arcpy.GetMessages()