ArcGIS includes two geoprocessing tools that help you transfer sets of tiles from one cache to another: Export Map Server Cache and Import Map Server Cache, both in the Server Tools toolbox. They are useful for collaborative caching jobs where different organizations contribute tiles to one primary cache. These tools can also be used to move subsets of tiles to machines for offline use.
When to use the export and import tools
The following scenarios provide examples of how you can use the Export Map Server Cache and Import Map Server Cache geoprocessing tools.
Best-available cache
Suppose you're in charge of maintaining an imagery cache for your state. One of the counties in your state has new high-resolution imagery that it wants to contribute to your cache. You ask the county to export its cache to an external hard drive or an accessible network location where you can retrieve the exported tiles. You then import the tiles into the state cache.
Collaborative cache
The best-available cache idea can be extended to multiple contributors. Imagine you're coordinating a web mapping project for an association of several local governments in your region. Each local government has its own GIS database and mapping applications; however, all have agreed on a matching cartographic style and cache tiling scheme.
In this scenario, you decide to build a collaborative cache made of tiles from each local government. Each local government exports the cache tiles that fall within its boundaries. You then import these tiles into one primary cache for your web map. Members of the public who view the map on the Internet may not even recognize that the data came from different sources.
Disconnected cache
ArcGIS apps can read tile caches from disk as if they were any other raster dataset. There is no need for a supporting map service. In this scenario, you move subsets of tiles to other machines for offline use.
Suppose you work for a large city and you've set up a cached map service with imagery. Your employees like to use this service in maps to give context to their work. However, some of the employees must occasionally take laptops onto job sites where internet access is not available.
You decide to export a copy of the cache to a shared location on the network. Your employees can now import tiles from this location onto their laptops. To avoid getting more tiles than they need, the employees create a feature class of their area of interest and use it to define the import area. When the employees open the map on the laptops, they browse to the imported cache and add it to the map as they would with other raster datasets.
The basics of exporting and importing tiles
The workflow for exporting and importing tiles includes the following steps:
1. Export a set of tiles
The first step is to export tiles from the source cache using the Export Map Server Cache tool. You can optionally define an area of interest to constrain the boundaries of the export. In this way the tools give you an advantage over copying and pasting tiles. With simple copy and paste, it would be difficult to spatially isolate a subset of tiles to an area of interest.
When you export based on a feature class boundary, the exported area is essentially clipped to the boundary of the feature class. Areas outside the feature class boundary on peripheral tiles are made transparent (if the source cache is PNG or MIXED) or have the background color burned in (if the source cache is JPEG).
The source destination can be a shared location on the network, a web-enabled folder, an occasionally disconnected laptop, or a piece of hard media. If the ArcGIS Server account doesn't have write access to the target destination, which might happen in cloud computing scenarios, you can check the box Copy data from server. This puts the tiles in the server output directory, from which the client then downloads them. This option is slower, but it opens up your export to a wider variety of clients.
The tiling scheme and basic cache dimension information are exported with the tiles in the conf.xml and conf.cdi files, respectively. These files are essential for clients such as ArcGIS Pro to retrieve basic information about the cache.
Finally, Export Map Server Cache allows you to convert between cache storage formats (compact and exploded). This is necessary because you cannot mix storage formats in a cache. If you export large tile sets that will be copied to disconnected environments, use the compact format. The compact format takes less disk space and allows for much faster copying than the exploded format.
2. Use the tiles as a disconnected raster dataset (optional)
Once you export tiles, you can choose to use them directly from disk as a raster dataset in ArcGIS Pro. Click Add Data and browse to the location where you exported the tiles. Many workflows will not need this step, but it is an option. You can also stop here, and choose not to import the tiles anywhere else.
3. Import the tiles into another cache (optional)
The Import Map Server Cache tool brings an exported set of tiles into an existing cache. The tiling scheme of the caches must match. The image format of the caches must also match or the receiving cache must use the mixed image format.
You can optionally define an area of interest for the import. This is useful if someone has exported an entire cache and you only want to retrieve a specific part of it.
If the ArcGIS Server account doesn't have read access to the source cache, you can check Upload data to server. This puts the tiles into the server system directory. The server then automatically moves the tiles into the server cache directory.
The importance of image format
When importing tiles from one cache to another, the cache image formats must match.
When possible, use PNG or mixed caches when you export and import tile caches. JPEG caches do not have the ability to recognize the background color of a tile as transparent. If you must use JPEG tiles that contain a background color, be aware that the background color of those tiles will be introduced into the receiving cache. If the target cache has a different background color to begin with, importing will cause the target cache to have two background colors.
Choosing whether to merge or overwrite tiles
When tiles are exported or imported into a cache, transparent pixels in the originating cache are ignored by default. This results in a merged or blended image in the receiving cache. For example, you can import tiles with point and line features into a basemap cache without overwriting the basemap image.
In some scenarios where a blended image would not be appropriate, you might want to force the import or export to replace all pixels in the area of interest. To do this, check the box Overwrite Tiles when you run the export or import tools. Be aware that if the originating cache contains transparent pixels, the receiving cache will also become transparent in those areas.
This choice is irrelevant with JPEG caches, which do not support transparent pixels.
Allow clients to export cache tiles
The ArcGIS client APIs allow apps to download map tiles from the server for offline use. When you allow clients to export cache tiles for the service, you enable a series of operations in the REST API that authorize these downloads to occur. To learn more about these operations, see Export Tiles.
Large downloads of tiles can negatively affect your server performance and overwhelm the storage on the client device. Use the Limit export cache setting to define the maximum number of tiles a client can request at once.
Tip:
To decide the maximum number of tiles to allow for download, you may find it useful to determine the average area your clients would likely to download, and then review the total number of tiles in that area. See View cache completion status.
Exported tiles are placed in the server output directory. When you've allowed clients to export tiles, you may want to increase the maximum allowed age for files in the server output directory. The default of 10 minutes may not be long enough for the client to retrieve the tiles before they are cleaned up. See Edit a server directory in ArcGIS Server Manager for steps to make this edit.
Export performance
The REST API uses the caching controller service to export tiles. The number of instances allocated to CachingTools, map, or image services does not affect performance. To increase the number of parallel exportTiles operations supported at any given time, increase the number of instances of the caching controller service. Use the formula 3*N, where N is the number of cores on a single ArcGIS Server machine in the site.