Build Mosaic Dataset Item Cache (Data Management)

License Level:BasicStandardAdvanced

Summary

Inserts the Cached Raster function into the function chain for items within a mosaic dataset.

Usage

Syntax

BuildMosaicDatasetItemCache_management (in_mosaic_dataset, {where_clause}, {define_cache}, {generate_cache}, {item_cache_folder}, {compression_method}, {compression_quality}, {max_allowed_rows}, {max_allowed_columns}, {request_size_type}, {request_size})
ParameterExplanationData Type
in_mosaic_dataset

The input mosaic dataset.

Image Service; Mosaic Layer; String
where_clause
(Optional)

Using SQL, you can define a query or use the Query Builder to build a query, if you want to choose which items to cache.

SQL Expression
define_cache
(Optional)

Choose to define the mosaic dataset cache. A Cached Raster function will be inserted to the selected items. If an item already has a Cached Raster function, it will not add another one.

  • DEFINE_CACHEThe Cached Raster function will be added to the selected items. If an item already has this function, it will not add another one. This is the default.
  • NO_DEFINE_CACHENo raster cache will be defined.
Boolean
generate_cache
(Optional)

Choose to generate the cache files based on the properties defined in the Cached Raster function, such as the location and the compression of the cache.

  • GENERATE_CACHECache will be generated. This is the default.
  • NO_GENERATE_CACHECache will not be generated.
Boolean
item_cache_folder
(Optional)

The location where the cached dataset will be stored.

By default, the cache is generated and stored in a folder next to where the mosaic dataset resides. This folder has the same name as the geodatabase, with a .cache extension. However, if the mosaic dataset is created in an ArcSDE geodatabase, the cache will be created within that geodatabase.

Once an item cache is created, regenerating an item cache to a different location is not possible by specifying a different Cache Path and rerunning this tool. It will still generate the item cache in the location where it was generated the first time. However, you can remove this function and insert a new one with the new path or use the Repair Mosaic Dataset tool to modify the cache path, then run this tool to generate the item cache in a different location.

Workspace
compression_method
(Optional)

The type of compression, if any, that will be used when generating the cache.

  • LosslessLossless compression retains the values of each pixel when generating the cache dataset.
  • LossyLossy compression does not retain the exact values of each pixel when generating the cached dataset. When using this method, a compression quality can also be set.
  • NoneNo compression will be used when generating the cached dataset.
String
compression_quality
(Optional)

The compression quality to use when lossy compression method is used. The compression quality value is between 1 and 100 percent.

Long
max_allowed_rows
(Optional)

Limits the size of the cache dataset by number of pixels, in rows.

The cache raster will be not be generated if the dimension is beyond this limit.

Long
max_allowed_columns
(Optional)

Limits the size of the cache dataset by number of pixels, in columns.

The cache raster will be not be generated if the dimension is beyond this limit.

Long
request_size_type
(Optional)

Choose whether to specify a pixel size factor or a pixel size, while resampling your item cache.

  • PIXEL_SIZE_FACTORAllows you to choose a scaling factor to resample the cached raster. This is the default. If you do not wish to resample the cache, then choose PIXEL_SIZE_FACTOR with a factor of 1.
  • PIXEL_SIZEAllows you to specify the pixel size at which to create the cached raster.
String
request_size
(Optional)

Specify the request size. The value that you type will be based on the request_size_type option. If you chose PIXEL_SIZE_FACTOR, then your value will be a scaling factor. If you chose PIXEL_SIZE, then your value will be the resampled pixel size.

Double

Code Sample

BuildMosaicDatasetItemCache example 1 (Python window)

This is a Python sample for BuildMosaicDatasetItemCache.

import arcpy
arcpy.BuildMosaicDatasetItemCache_management(
     "C:/Workspace/itemcache.gdb/md",  "#", "DEFINE_CACHE", 
     "NO_GENERATE_CACHE", "C:/workspace/itemcache", "LOSSY", 
     "80", "#", "#")
BuildMosaicDatasetItemCache example 2 (stand-alone window)

This is a Python script sample for BuildMosaicDatasetItemCache.

#Define mosaic dataset item cache without generating the cache file

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

mdname = "itemcache.gdb/md"
query = "#"
definecache = "DEFINE_CACHE"
generatecache = "NO_GENERATE_CACHE"
cachepath = "C:/workspace/itemcache"
compression = "LOSSY"
compquality = "80"
maxrow = "#"
maxcolumn = "#"

arcpy.BuildMosaicDatasetItemCache_management(
     mdname, query, definecache, generatecache, cachepath, compression, 
     compquality, maxrow, maxcolumn)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015