Manage Tile Cache (Data Management)

License Level:BasicStandardAdvanced

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

Syntax

ManageTileCache_management (in_cache_location, manage_mode, {in_cache_name}, {in_datasource}, {tiling_scheme}, {import_tiling_scheme}, {scales}, {area_of_interest}, {max_cell_size})
ParameterExplanationData 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:

  • RECREATE_ALL_TILESExisting tiles will be replaced and new tiles will be added if the extent has changed or if layers have been added to a multilayer cache.
  • RECREATE_EMPTY_TILESOnly tiles that are empty will be created. Existing tiles will be left unchanged.
  • DELETE_TILESTiles will be deleted from the cache. The cache folder structure will not be deleted.
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.

  • ARCGISONLINE_SCHEMETo use the default ArcGIS Online tiling scheme.
  • IMPORT_SCHEMETo import an existing 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,

  • For levels of cache that lies within the visibility ranges of the data source, the cache is generated from the data source.
  • For levels of cache that falls outside the visibility of the data source, the cache is generated from the previous level of cache.

If the value is greater than zero,

  • For levels with cell sizes smaller than or equal to Maximum Source Cell Size (max_cell_size), the cache is generated from the data source.
  • For levels with cell sizes greater than Maximum Source Cell Size (max_cell_size), the cache is generated from the previous level of cache.

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

ManageTileCache example 1 (Python window)

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", "#", "#", "#")
ManageTileCache example 2 (stand-alone script)

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

Related Topics

Licensing Information

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