Tips and best practices for map caches
The tips below can help you achieve the best appearance and performance for your map caches. The tips are arranged in the following categories:
Preparing the map document
If possible, choose the scales you want to cache before you start designing the map. Work at those scales as you create the map in ArcMap. For quick reference, you can manually load those scales into the drop-down list of scales in ArcMap.
Before caching your map, do a visual check of the source map document at each scale that you plan to cache. Make sure that the appropriate layers appear with effective symbology and labeling at each scale. If you need to change the symbology of a layer based on scale, you can copy the layer and paste it back into the ArcMap table of contents. Set a scale range on each copy of the layer and symbolize appropriately for that scale range.
The images below show an ArcMap document that has been symbolized for viewing at two scales. The author of this map copied and pasted the Interstates and Cities layers back into the data frame, then symbolized a zoomed in and zoomed out version for each layer.
In the zoomed out map, the author set a definition query to limit the visible cities to those with a population of more than 50,000. Also, the author symbolized the Interstates layer with a thin line.
In the zoomed in map, the author removed the definition query so that all cities are visible. However, the author added label rules that symbolize larger cities with a larger font. The author also changed the Interstate symbolization to use a thicker cartographic line symbol.
The author set scale ranges on both the zoomed in and zoomed out layers to ensure that only one of the layers is visible at any given scale. The Rivers and Lakes, County Boundaries, Parks, and State Background layers use the same symbol whether zoomed in or out, so the author did not create copies of these layers.
If you're creating a map that you intend to cache at many scale levels, you need to repeat this process, potentially creating many copies of layers in your map document. Use group layers to keep them organized.
Set X Offset and Y Offset values on text symbols to 0. Using text symbol offsets may result in periodic inadvertent label truncation. Use the label engine's offset ability instead.
Explicitly define a data frame background color not used elsewhere in your map (RGB 254,255,255 is a good choice). Otherwise, any symbols and text that happen to be the same as the background color may appear as transparent.
You can explicitly set the background color in ArcMap. The background appears transparent in environments that support PNG 24 and PNG 32 transparency.
Before starting a large caching job, make a test cache of a small area at all scale levels. You can do this by making a small feature class that covers your test area. Then, when you create the cache, choose the option to create tiles based on an area of interest. When you've created the cache for this small area, examine the tiles to make sure they look and perform the way you expect. One way to do this is to use the Services Directory to preview the service.
Creating the cache
-
Make sure you've created enough scales to visualize your data adequately. ArcMap users see resampled cache tiles when they are in between scales. Caching too few scales causes more resampling and possible distortion of features. At the same time, you want to avoid unnecessarily large scales so that you do not waste time on tile creation.
Try to use the same tiling scheme for all caches created in your organization. If you'll be bringing cached services into your web applications from another organization or department, you may want to match their tiling scheme or agree on one that you can share. The ArcGIS Online/Google Maps/Bing Maps is an example of a well-known common tiling scheme.
When creating caches that will overlay each other in a web application, use the same tiling scheme if possible. It's not required that you create all the caches at all the same scale levels. However, you should match as many scales as possible.
In the image below, three caches with different scale ranges share the same scales where possible. Shared scales are circled in red:
Before you begin creating tiles, ensure that your ArcGIS Server log level is set to Severe or Warning. These levels only report problems or errors. Because caching makes rapid repeated draw requests to the server, you want to avoid detailed information being logged for each request.
When creating cache tiles, use the Area of interest option to avoid creating tiles for areas that you don't need. It may be useful to create a new feature class that specifically outlines the areas that you want to precreate. You can use this feature class as the area of interest whenever you create or update your cache.
Avoid using on-demand caching to build your entire cache. A good practice is to precreate tiles for areas that you anticipate will be frequently visited and use on-demand caching only for areas that will be visited rarely.
To improve performance, consider using local data instead of data hosted on a shared network drive or enterprise geodatabase. Placing identical file geodatabases on each GIS server is often the fastest way to access data for caching. See Data storage considerations for an ArcGIS Server site to learn if this is the best option for your site.
Set the minimum and maximum number of instances for your System/CachingTools service in such a way that your service instances, represented by ArcSOC.exe processes, are not being underutilized (by sitting idle) or overutilized (by monopolizing all your CPU resources). See Allocation of server resources to caching for a detailed discussion of this topic.
Examine the geoprocessing tool messages after running Manage Map Server Cache Tiles. If any service instances crashed during tile creation, the scales and extents of the missed areas are written in the geoprocessing tool messages. You can then rerun the cache for these particular extents to fill in the missing tiles.
Maintaining the cache
If your source data tends to change, you can use a Python script to automatically run the Manage Map Server Cache Tiles geoprocessing tool on a regular basis. This tool can update all or selected areas of your cache. See Automating cache creation and updates with geoprocessing for an example.
After the cache is created, if you don't want to continue storing all the source data on your server, you can remove some of the layers from the source map document. Leave at least one layer in the map document (a suggestion is a simple feature class with one feature covering the map extent), and leave the map document in the coordinate system used to create the cache. After you restart the service, you can safely remove the source data from the server for any layers you removed. As long as the service name and the cache name stay the same, users continue to see the cache when they view the service.
Keep in mind that if you use this technique, users will not get any meaningful results when they query the service. If you want to maintain some queryable layers, you should leave them in the map document and leave the source data for those layers on the server.