Below are common questions that have been asked about map caching. Topics range from basic to advanced. In many cases, the answers restate information found elsewhere in the help; however, this topic may provide an answer to your specific question faster than searching the help.
Caching questions
- Why do the caching tools restart my services?
- Can I share the cache directory between multiple ArcGIS Server sites?
- If I delete my service, is the cache also deleted?
- Can I print maps with cached content?
- How do I generate a full cache at some scales and a partial cache at other scales?
- How do I display a Data not available tile for empty cache areas?
- How do I avoid duplicate labels in my cache?
- When creating a cache based on an area of interest, why do I see extra tiles created outside the area of interest?
- When creating tiles on demand, why are extra tiles created outside the user's map extent?
Caching questions
Manage Map Server Cache Tiles and other caching tools do several things behind the scenes that require restarting the service before and after the tool runs. If the caching tools alter the conf.xml tiling scheme file, restarting is required for the map service to pick up the changes. For example, if you used Manage Map Server Cache Scales to add or delete scales from your cache, restarting would be required for the map service to recognize the changes to the tiling scheme.
The service is briefly unavailable while restarting.
Yes. If you have multiple ArcGIS Server sites, for example, such as a development site and a production site, you can share the cache directory between the sites. This eliminates the need for you to copy or replicate the cache from one site to another. This also allows you to read from and write to a single cache directory from multiple sites.
When setting up your cache directory to be accessible between sites, you must share the directory over your network and grant each site's ArcGIS Server account access to the cache directory. This account is used to read and, if necessary, write tiles to the cache. To learn more about the ArcGIS Server account, see ArcGIS Server account.
You should only grant the necessary level of permissions to the ArcGIS Server account. For example, if the site you're sharing the cache directory with only needs to read tiles from the cache, you should only grant read permissions to the account. Conversely, if you'll be creating cache tiles from each site, you'll need to grant read and write access to the ArcGIS Server account for each site.
Caution:
If you'll be creating cache tiles in the same cache directory from multiple sites, you need to exercise extreme caution as your existing caches may be overwritten by another site. For example, if you have two map services with the same name on different sites, you may overwrite the existing cache for the map service on site A if a cache job is accidentally started for the map service on site B.
After you've shared your cache directory, you'll need to update each site to reference the shared network location. For instructions, see Edit a server directory in ArcGIS Server Manager.
No. The cache tiles, tiling scheme, and folder structure are retained on disk. If you want to delete the cache completely, use the Delete Map Server Cache tool. If you want to delete the tiles but leave the cache folder structure and tiling scheme, use the Manage Map Server Cache Tiles tool with the Update Mode set to Delete_Tiles.
Although the standards for map caches and web map printing align in the need for consistent performance at many scales, you may find that the resolution of a cached map service is unsatisfactory for printing. Printed maps often require a resolution of 200 dots per inch (dpi) or greater, while map caches in ArcGIS generally display at 96 dpi.
To accommodate this discrepancy in resolution, the PrintingTools service built into ArcGIS Server uses dynamic layers. Dynamic layers are automatically enabled on map services. When a map service or WMS service with cached content has dynamic layers enabled, the service performs a dynamic operation that will query the source data for the map service to export the map extent at a higher resolution, bypassing the map cache.
If dynamic layers are disabled on a map service or WMS service with cached content, the PrintingTools service will instead export the map extent from the cache on the server site. The resulting map will be at the 96 dpi resolution of the map cache, which may not meet the expectations for a printed map. As such, it is recommended that you enable dynamic layers for cached map services using the PrintingTools service.
At large scales, it's recommended that you pre-create the tiles that you anticipate will be the most popular and set the rest of the tiles to be created on demand. In contrast, at small scales, it is recommended that you create a full cache because the small scales require fewer tiles and will be frequently viewed by clients when they initially see the map.
You can run the Manage Map Server Cache Tiles tool multiple times to build a partial cache at some levels of your map and a full cache at other levels.
Suppose you have a map that you want to cache at these scales:
- 1:128,000
- 1:64,000
- 1:32,000
- 1:16,000
- 1:8,000
- 1:4,000
You could run Manage Map Server Cache Tiles and check only the 1:128000, 1:64000, and 1:32000 boxes. By default, the full extent of those scales will be cached.
Then you could run the tool again and check only the 1:16000, 1:8000, and 1:4000 boxes. Also, you could choose to cache these scale levels based on the extent of features in a feature class, such as a city or county boundary, instead of caching the full extent of the map. This creates a partial cache at those three scale levels. Optionally, you could choose to have the rest of the tiles at those scales be created on demand.
If an area of your cache does not exist, you can either create the tile on demand or configure your web server to return a Data not available tile. The Data not available tile is also useful if someone pans to the edge of the map or browses to an area where you have not completed caching. Configuring your server to return a Data not available tile can, in some cases, yield a better user experience than returning nothing.
For REST-based applications, such as those you build with the ArcGIS Maps SDK for JavaScript, you configure a Data not available tile by placing an empty tile—missing.png, missing.jpg, or blank.png—at the root level of your cache. The server defaults to this tile if a tile cannot be found in the cache. To configure the tile, complete the following steps:
- Create an image of the same dimensions and image format as a tile in your tiling scheme. Name it missing.png or missing.jpg. If a clear blank tile is needed (such as for overlay services that require transparency), use blank.png instead. To download an example tile, see the Configure the cache folder to display a 'Data not available' tile for empty map cache areas or missing tiles Technical Support article.
- Save the missing.png, missing.jpg, or blank.png file under the _alllayers folder for the map service, for example, opt/arcgis/server/usr/directories/arcgiscache/MyMapService/Layers/_alllayers/missing.png.
The server automatically handles missing tiles by replacing the expected but missing tiles with the special missing or blank tile at the root level of the cache.
If you are using a dynamic labeling engine in your map document to place labels (as opposed to annotation), you may occasionally see duplicate labels in your cache tiles. These should not occur any more frequently than 4,096 pixels in any direction. You can eliminate all duplicate labels by using annotation. When you use annotation, labels are associated with one point on the map and duplicates do not occur.
When creating a cache based on an area of interest, why do I see extra tiles created outside the area of interest?
To avoid duplicate labels on tiles, the caching tools originally draw areas of 4,096 pixels by 4,096 pixels (256 tiles of the default 256 by 256 pixel tile size), which are then cut into tiles of the size you requested in your tiling scheme. Depending on the tiling scheme, as well as the location and shape of your area of interest, some tiles in the 4,096 by 4,096 area might fall outside the boundary of the area of interest. This is expected behavior. You should not see tiles created outside the boundary of your area of interest beyond 4,096 pixels in any direction.
When you request new tiles (either on demand or using the caching tools), the tiles are always created in groups. The caching mechanism will never create just one tile at a time. If it did, you would see many duplicate labels because the server would not be aware of the labels on adjacent tiles.
When you have on-demand caching enabled and you pan to an uncached area, a 4,096 by 4,096 pixel area is drawn by the server and cut into tiles (this area is 2,048 by 2,048 when using antialiasing). Therefore, if your tiles are 256 by 256 pixels in dimension, you could expect up to 256 tiles to be created. If your map contains many layers or complex symbols, this could result in long wait times for the client.
For this reason, it's strongly recommended that you pre-create tiles for popular areas of your map and use on-demand caching only in the less popular areas. Avoid building your entire cache on demand if you have a complex source map document.