Add Rasters To Mosaic Dataset (Data Management)

License Level:BasicStandardAdvanced

Summary

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

Usage

Syntax

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}, {force_spatial_reference})
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 for imagery products. It identifies metadata, such as georeferencing, acquisition date, and sensor type, along with a raster format. For a list of raster types, see the list of supported raster and image data formats.

If you are using a LAS, LAS Dataset, or Terrain raster Type, an *.ART file must be used, where the cell size is specified.

Raster Type
input_path
[input_path,...]

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

Not all input choices will be available. Those available will depend on the selected raster type.

  • DatasetAllows you to select an ArcGIS geographic dataset, such as any raster, raster catalog, or mosaic dataset in a geodatabase, or a table.
  • WorkspaceAllows you to select a folder containing multiple raster datasets. The folder can contain subfolders.This is affected by the Include Sub Folders and Input Data Filter parameters.
  • 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.Do not use this with file formats that are raster datasets, such as TIFF or MrSID files—use Dataset.
  • 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; Terrain Layer; WCS Coverage; Image Service; MapServer; WMS Map; Dataset; Layer File; Terrain; LAS Dataset Layer
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.

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

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.
Boolean
update_overviews
(Optional)

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

If you want to add in only a TIFF image, you can add an asterisk before a file extension.

  • *.TIF

If you want to add in any image with the word sensor in the file path or the file name, you need to add an asterisk before and after the word sensor.

  • *sensor2009*

Or you can use PERL syntax to create a data filter.

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

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

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

String
sub_folder
(Optional)

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

  • 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.
String
build_pyramids
(Optional)

Builds pyramids for each source raster.

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

Calculates statistics for each source raster.

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

Builds thumbnails for each source raster.

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

A description you want used to represent this 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)

Use the coordinate system that is specified for all the rasters when loading data into the mosaic dataset.

  • NO_FORCE_SPATIAL_REFERENCEKeep the coordinate system of each raster data when loading data. This is the default.
  • FORCE_SPATIAL_REFERENCEForce the coordinate system specified in this tool for each raster when loading data.
Boolean

Code Sample

AddRastersToMosaicDataset example 1 (Python window)

This is a Python sample for the AddRastersToMosaicDataset tool.

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

This is a Python script sample for the AddRastersToMosaicDataset tool.

#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

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013