Manage Tile Cache (Data Management)
Summary
Creates a tile cache and updates tiles in an existing tile cache. This tool is used to create new tiles, replace missing tiles, overwrite outdated tiles, and delete tiles.
Usage
-
To create cache in a custom tiling scheme, make sure you have a tiling scheme defined for your source dataset before using this tool. You can use the Generate Tile Cache Tiling Scheme tool to create the tiling scheme.
To create a cache in ArcGIS Online Tiling Scheme, you can specify ARCGISONLINE_SCHEME for the Input Tiling Scheme parameter while running this tool.
This tool may take a long time to run for caches that cover a large geographic extent or very large scales. If the tool is cancelled, tile creation is stopped, but the existing tiles are not deleted. This means you can cancel the tool if you run out of time and rerun it later on the same cache and specify RECREATE_EMPTY_TILES for the Manage Mode parameter.
This tool supports the Parallel Processing environment setting.
Syntax
Parameter | Explanation | Data Type |
in_cache_location |
The folder in which the cache dataset is created or path to an existing tile cache. | Raster Layer;Mosaic Layer;Folder |
manage_mode |
Choose a mode for managing the cache. The three modes are:
| String |
in_cache_name (Optional) |
Name of the cache dataset to be created inside the Cache Location. | String |
in_datasource (Optional) |
A raster dataset or a mosaic dataset. This is not required when DELETE_TILES is specified in the Manage Mode (manage_mode) parameter. | Mosaic Layer;Raster Layer |
tiling_scheme (Optional) |
An optional parameter to specify tiling scheme.
| String |
import_tiling_scheme (Optional) |
Path to an existing scheme file (XML file) or imported from an existing image service or map service. | Image Service ; MapServer; File |
scales [scale,...] (Optional) |
The scale levels at which you will create or delete tiles when running this tool, depending on the value of the Manage Mode (manage_mode) parameter. The pixel size is represented based on the spatial reference of the tiling scheme. | Double |
area_of_interest (Optional) |
Defines an area of interest to constrain where tiles will be created or deleted. This can be a feature class, or it can be a feature that you interactively define in ArcMap. This parameter is useful if you want to manage tiles for irregularly shaped areas. It's also useful in situations where you want to precache some areas and leave less-visited areas uncached. | Feature Set |
max_cell_size (Optional) |
The value that defines the visibility of the data source for which the cache will be generated. By default, the value is empty. If the value is empty,
If the value is greater than zero,
The unit of the Maximum Source Cell Size value should be the same as the unit of the cell size of the source dataset. | Double |
Code Sample
This is a Python sample for the ManageTileCache tool.
import arcpy
arcpy.ManageTileCache_management("C:/CacheDatasets/Manage", "RECREATE_ALL_TILES", "Test", "C:/Data/Cache.gdb/Md", "IMPORT_SCHEME",
"C:/Schemes/TilingScheme.xml", "#", "#", "#")
This is a Python script sample for the ManageTileCache tool.
#===========================
#Manage Tile Cache
'''Usage: ManageTileCache_management(in_cache_location, { RECREATE_ALL_TILES | RECREATE_EMPTY_TILES | DELETE_TILES },
{in_cache_name}, {in_datasource}, { ARCGISONLINE_SCHEME | IMPORT_SCHEME } , {import_tiling_scheme},
{scales;scales...}, {area_of_interest}, {max_cell_size})
'''
try:
import arcpy
arcpy.env.workspace = "C:/Workspace"
#Generate tile cache for 3 out of 5 levels defined in tiling scheme
folder = "CacheDatasets/Manage"
mode = RECREATE_ALL_TILES
cacheName = "Test"
dataSource = "Cache.gdb/md"
method = "IMPORT_SCHEME"
tilingScheme = "Schemes/Tilingscheme.xml"
scales = "4000;2000;1000"
areaofinterest = "#"
maxcellsize = "#"
arcpy.ManageTileCache_management(folder, mode, cacheName, dataSource, method,
tilingScheme, scales, areaofinterest, maxcellsize)
# Use ArcGIS Online tiling scheme to generate tile cache
folder = "CacheDatasets/Manage"
mode = RECREATE_ALL_TILES
cacheName = "Test"
dataSource = "Cache.gdb/md"
method = "ARCGISONLINE_SCHEME"
tilingScheme = "#"
scales = "#"
areaofinterest = "#"
maxcellsize = "#"
arcpy.ManageTileCache_management(folder, mode, cacheName, dataSource, method,
tilingScheme, scales, areaofinterest, maxcellsize)
#Delete tile cache for some levels
cachelocation = "CacheDatasets/Manage/Test"
mode = "DELETE_TILES"
cacheName = "#"
dataSource = "#"
method = "#"
tilingScheme = "#"
scales = "4000;500"
areaofinterest = "#"
maxcellsize = "#"
arcpy.ManageTileCache_management(folder, mode, cacheName, dataSource, method,
tilingScheme, scales, areaofinterest, maxcellsize)
except:
print "Manage Tile Cache example failed"
print arcpy.GetMessages()
Environments
- Parallel Processing Factor
If the Parallel Processing Factor value is empty (blank), the tool will run with a default value of "50%" (one-half of the available cores).