Synchronize Mosaic Dataset (Data Management)

License Level:BasicStandardAdvanced

Summary

Rebuilds or updates each raster item in the mosaic dataset and updates affected fields in the attribute table, using the raster type and options that were used when it was originally added.

Synchronization is a one-way operation: changes in the source data can be synchronized to the mosaic dataset’s attribute table, but changes in the attribute table will not affect the source data (but may be overwritten by the synchronization).

NoteNote:

Changes made with the synchronization cannot be undone. You may want to create a backup copy if you've made modifications to your mosaic data that could be overwritten.

Usage

Syntax

SynchronizeMosaicDataset_management (in_mosaic_dataset, {where_clause}, {new_items}, {sync_only_stale}, {update_cellsize_ranges}, {update_boundary}, {update_overviews}, {build_pyramids}, {calculate_statistics}, {build_thumbnails}, {build_item_cache}, {rebuild_raster}, {update_fields}, {fields_to_update}, {existing_items}, {broken_items})
ParameterExplanationData Type
in_mosaic_dataset

The path and name of the mosaic dataset.

Mosaic Layer
where_clause
(Optional)

Using SQL, you can define a query or use the Query Builder to build a query.

SQL Expression
new_items
(Optional)

Choose whether to synchronize your mosaic dataset with newly added items. If you choose to use this option, the item's workspace will be searched for new data. When data is added to the mosaic dataset, it will use the same raster type as the other items within the same workspace.

If you choose to update with the new items, you can optionally choose whether to update cell size ranges, boundary, or overviews.

  • NO_NEW_ITEMSDo not add any new items that may exist. This is the default.
  • UPDATE_WITH_NEW_ITEMSUpdate the mosaic dataset with the new items in the workspaces, where existing mosaic dataset items are stored.
Boolean
sync_only_stale
(Optional)

Choose whether to update all primary items or only stale primary items.

An item is considered stale if the corresponding source files that are used to construct the raster values are modified after the item is created. For instance, the georeferencing may have been updated or the pyramids may have been built.

  • SYNC_STALEOnly update the stale items. This is the default.
  • SYNC_ALLUpdate all selected items of the mosaic dataset.
Boolean
update_cellsize_ranges
(Optional)

Choose whether to update the cell size ranges.

  • UPDATE_CELL_SIZESThe cell size ranges will be recalculated for the entire mosaic dataset, but only the items that have an invalid visibility will be updated. This is the default.
  • NO_CELL_SIZES The cell size ranges will not be recalculated.
Boolean
update_boundary
(Optional)

Choose whether to update the boundary.

  • UPDATE_BOUNDARY The boundary will be rebuilt after the mosaic dataset is synchronized. This is the default.
  • NO_BOUNDARY The boundary will not be rebuilt.
Boolean
update_overviews
(Optional)

Choose whether to update any obsolete overviews. The overview becomes obsolete if any underlying rasters have been modified.

  • NO_OVERVIEWS The overviews will not be rebuilt. This is the default.
  • UPDATE_OVERVIEWS The affected overviews will be rebuilt after the mosaic dataset is synchronized.
Boolean
build_pyramids
(Optional)

Choose whether to build pyramids for the specified mosaic dataset items. Pyramids can be built for each raster item in the mosaic dataset. Pyramids can improve the speed at which each raster is displayed.

  • NO_PYRAMIDSPyramids will not be generated. This is the default.
  • BUILD_PYRAMIDS Pyramids will be generated for all the raster items specified by this tool.

Pyramids will not be built for newly added items, if the items are added in the same instance of running this tool.

Boolean
calculate_statistics
(Optional)

Choose whether to calculate statistics for the specified mosaic dataset items. Statistics can be calculated for each raster item in the mosaic dataset. Statistics are required for your mosaic dataset when performing certain tasks, such as applying a contrast stretch.

  • NO_STATISTICSStatistics will not be calculated. This is the default.
  • CALCULATE_STATISTICS Statistics will be calculated for all the raster items specified by this tool.

Statistics will not be built for newly added items, if the items are added in the same instance of running this tool.

Boolean
build_thumbnails
(Optional)

Choose whether to build thumbnails for the specified mosaic dataset items. Thumbnails are small, highly resampled images that can be created for each raster item in the mosaic definition. Thumbnails can be accessed when the mosaic dataset is accessed as an image service and will display as part of the metadata (Item Description).

  • NO_THUMBNAILSNo thumbnails will be created or updated. This is the default.
  • BUILD_THUMBNAILSThumbnails will be generated or updated for all the raster items specified by this tool.

Thumbnails will not be built for newly added items, if the items are added in the same instance of running this tool.

Boolean
build_item_cache
(Optional)

Choose whether to build a cache for the specified mosaic dataset items. A cache can be created when you've added data using the LAS, Terrain, or LAS Dataset raster types. Items can also be cached using the Cached Raster function.

  • NO_ITEM_CACHENo cache will be created or updated. This is the default.
  • BUILD_ITEM_CACHEThe cache will be generated or updated for all the raster items specified by this tool.

The cache will not be built for newly added items, if the items are added in the same instance of running this tool.

Boolean
rebuild_raster
(Optional)

Choose whether to rebuild the raster items from the data source using the original raster type.

  • REBUILD_RASTERRebuild the rasters from the source data. You will lose any changes that you have performed on selected items in the mosaic dataset. This is the default.
  • NO_RASTERDo not rebuild the rasters. Other primary fields are reset if update_aux_fields is chosen.

This will only affect items that will be synchronized. This parameter is not applicable if UPDATE_WITH_NEW_ITEMS has been chosen.

Boolean
update_fields
(Optional)

Choose whether to update the fields within the table. This will only affect items that will be synchronized.

  • UPDATE_FIELDSUpdate the fields from the source files. This is the default.
  • NO_FIELDSDo not reset the fields within the table from the source.

If you choose to update the fields, you can control which fields are updates by selecting them in the fields_to_update parameter. If you have made edits to some of the fields, you may want to unselect them in the fields_to_update parameter.

Boolean
fields_to_update
[field_to_update,...]
(Optional)

Specify which fields should be updated.

This parameter is only valid if the option for the update_fields parameter is UPDATE_FIELDS.

If you have made edits to some of the fields, you may want to make sure they are not listed.

The RASTER column can be refreshed, even if the REBUILD_RASTER keyword is not used. However, if the REBUILD_RASTER is being used, the RASTER column is rebuilt, even if this field is not specified.

String
existing_items
(Optional)

Choose whether you would like to update existing items within your mosaic dataset.

If you choose this option, you can then choose which existing parameters you would like to update: sync_only_stale, build_pyramids, calculate_statistics, build_thumbnails, build_item_cache, update_raster, update_fields, or fields_to_update.

  • UPDATE_EXISTING_ITEMSExisting items will be updated with the parameters that you have chosen to update. This is the default.
  • IGNORE_EXISTING_ITEMSExisting items will not be updated.
Boolean
broken_items
(Optional)

Choose whether you want to remove any broken links.

Make sure that all your network connections are working properly—this tool will remove any items that cannot be accessed.

  • IGNORE_BROKEN_ITEMSItems that have broken links will not be removed from the mosaic dataset. This is the default.
  • REMOVE_BROKEN_ITEMSItems that have broken links will be removed from the mosaic dataset.
Boolean

Code Sample

SynchronizeMosaicDataset example 1 (Python window)

This is a Python sample for SynchronizeMosaicDataset.

import arcpy
arcpy.SynchronizeMosaicDataset_management("c:/data/syncmd.gdb/md", "Year>1999", \
                                          "NO_NEW_ITEMS", "SYNC_STALE", "#", \
                                          "#", "#", "NO_PYRAMIDS", "NO_STATISTICS", \
                                          "NO_THUMBNAILS", "NO_ITEM_CACHE", \
                                          "NO_RASTER", "NO_FIELDS", "#")
SynchronizeMosaicDataset example 2 (stand-alone script)

This is a Python script sample for SynchronizeMosaicDataset.

#============================
#Synchronize Mosaic Dataset
'''Usage: SynchronizeMosaicDataset_management(in_mosaic_dataset, {where_clause}, {NO_NEW_ITEMS |
                                              UPDATE_WITH_NEW_ITEMS}, {SYNC_STALE | SYNC_ALL},
                                              {UPDATE_CELL_SIZES | NO_CELL_SIZES}, {UPDATE_BOUNDARY |
                                              NO_BOUNDARY}, {NO_OVERVIEWS | UPDATE_OVERVIEWS},
                                              {NO_PYRAMIDS | BUILD_PYRAMIDS}, {NO_STATISTICS |
                                              CALCULATE_STATISTICS}, {NO_THUMBNAILS |
                                              BUILD_THUMBNAILS}, {NO_ITEM_CACHE | BUILD_ITEM_CACHE},
                                              {UPDATE_RASTER | NO_RASTER}, {UPDATE_FIELDS | NO_FIELDS},
                                              {fields_to_update;fields_to_update...},
                                              {UPDATE_EXISTING_ITEMS | IGNORE_EXISTING_ITEMS},
                                              {IGNORE_BROKEN_ITEMS | REMOVE_BROKEN_ITEMS})
'''

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

    # Synchronize source and add new data
    mdname = "syncmd.gdb/mdnew"
    query = "#"
    updatenew = "UPDATE_WITH_NEW_ITEMS"
    syncstale = "SYNC_STALE"
    updatecs = "#"
    updatebnd = "#"
    updateovr = "#"
    buildpy = "NO_PYRAMIDS"
    calcstats = "NO_STATISTICS"
    buildthumb = "NO_THUMBNAILS"
    buildcache = "NO_ITEM_CACHE"
    updateras = "NO_RASTER"
    updatefield = "NO_FIELDS"
    fields = "#"

    arcpy.SynchronizeMosaicDataset_management(mdname, query, updatenew, syncstale,
                                              updatecs, updatebnd, updateovr, buildpy,
                                              calcstats, buildthumb, buildcache,
                                              updateras, updatefield, fields)

    # Synchronize data item after Year 1999
    # Add new data if available from the source
    # Do not update fields from source raster
    mdname = "syncmd.gdb/md"
    query = "Year>1999"
    updatenew = "NO_NEW_ITEMS"
    syncstale = "SYNC_STALE"
    updatecs = "#"
    updatebnd = "#"
    updateovr = "#"
    buildpy = "#"
    calcstats = "#"
    buildthumb = "BUILD_THUMBNAILS"
    buildcache = "#"
    updateras = "NO_RASTER"
    updatefield = "NO_FIELDS"
    fields = "#"

    arcpy.SynchronizeMosaicDataset_management(mdname, query, updatenew, syncstale,
                                              updatecs, updatebnd, updateovr, buildpy,
                                              calcstats, buildthumb, buildcache,
                                              updateras, updatefield, fields)


    # Synchronize LAS mosaic dataset and build cache
    # Rebuild raster item from source data and do not update Point Spacing
    mdname = "syncmd.gdb/lasmd"
    query = "#"
    updatenew = "NO_NEW_ITEMS"
    syncstale = "SYNC_ALL"
    updatecs = "#"
    updatebnd = "#"
    updateovr = "#"
    buildpy = "#"
    calcstats = "#"
    buildthumb = "BUILD_THUMBNAILS"
    buildcache = "BUILD_ITEM_CACHE"
    updateras = "UPDATE_RASTER"
    updatefield = "UPDATE_FIELDS"
    fields = "PointCount;Version;ZMax;ZMin"

    arcpy.SynchronizeMosaicDataset_management(mdname, query, updatenew, syncstale,
                                              updatecs, updatebnd, updateovr, buildpy,
                                              calcstats, buildthumb, buildcache,
                                              updateras, updatefield, fields)


    # Remove broken items from mosaic dataset
    mdname = "syncmd.gdb/mdbroken"
    query = "#"
    updatenew = "NO_NEW_ITEMS"
    syncstale = "SYNC_STALE"
    updatecs = "#"
    updatebnd = "#"
    updateovr = "#"
    buildpy = "#"
    calcstats = "#"
    buildthumb = "#"
    buildcache = "#"
    updateras = "#"
    updatefield = "#"
    fields = "#"
    updateexist = "IGNORE_EXISTING_ITEMS"
    removebroken = "REMOVE_BROKEN_ITEMS"

    arcpy.SynchronizeMosaicDataset_management(mdname, query, updatenew, syncstale,
                                              updatecs, updatebnd, updateovr, buildpy,
                                              calcstats, buildthumb, buildcache,
                                              updateras, updatefield, fields, updateexist,
                                              removebroken)



except:
    print "Synchronize Mosaic Dataset example failed."
    print arcpy.GetMessages()

Environments

Related Topics

Licensing Information

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