Build Mosaic Dataset Item Cache (Data Management)
Summary
Inserts the Cached Raster function into the function chain for items within a mosaic dataset.
Usage
The Cached Raster function is inserted on the top of every function chain; therefore, it's the last function implemented in the chain.
-
If you do not use the Generate Cache option on this tool to generate the cache, then you can use the Synchronize Mosaic Dataset tool to generate the cache.
The cache is not moved with the mosaic dataset when it is shared (published) to the server. If you will be building the cache for a mosaic dataset that will be published as an image service you may want to run this tool on the mosaic dataset after it has been shared to the server. Also, or in addition, make sure the path to the cache is accessible by the server. If you build the cache prior to publishing the mosiac dataset, you can move the cache to the server and update the cache path stored in the mosiac dataset.
Syntax
Parameter | Explanation | Data 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.
| 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.
| 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.
| 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.
| 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
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", "#", "#")
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)