Planning a map cache
Before you build a map cache, it's important to think about the tiling scheme you will use and the resources that will be needed to build the cache. You may also need to do extra design work on your map document to make sure that it is usable at each scale level in your tiling scheme.
Creating a large cache can take significant time and resources, so you want to make sure you'll be getting what you expect before you start the cache generation. If possible, run a test build of the cache on a smaller map area, or create just the first few levels of the cache to make sure that your images appear as you expect.
Designing maps that will be cached
When you create a paper map, it's visible at one scale only. Insets that show detailed areas of the map may use one or two additional scales. Fine-tuning your map for accurate generalization, symbology, and labeling can be a challenge even with this small number of scales. When you create a map that will be cached and viewed on a computer screen, you have the added responsibility of making sure the map is readable and useful at all cached scales.
Starting with a template
The Map Templates page in the ArcGIS Resource Center contains downloadable examples of multiscale maps. These "map templates" include a sample map document and dataset, which you can modify to fit your own data and design needs. Currently there are templates available for streets, topography, government infrastructure, trails, historical events, and reference overlays (to be viewed over imagery), with more templates on the way. Even if you don't plan to use the templates, just downloading a few and examining the organization of the map table of contents and datasets can help you learn how to build a successful multiscale map.
The remainder of this help topic delves into the design principles for cached maps, which you can see applied in the templates. If you're designing a map that will overlay ArcGIS Online, Bing Maps, or Google Maps services in a Web application, you should also read Designing a map to overlay ArcGIS Online, Google Maps, or Bing Maps.
Choosing scales and setting scale dependencies
You can ensure that your map is well designed by applying scale dependencies to labels and features. Examine the example cached images below. As you zoom in on the map, notice how the words and symbols change to convey more information. Road lines become thicker, and cities are represented by polygons instead of points. Similarly, the map switches to more detailed datasets, as the datasets used when zoomed out are too coarse to be useful at closer zoom levels. Streets and their labels only appear at the closest scales, since they would otherwise clutter the map. These scale-dependent changes help the map convey more information in an organized manner.
You can configure any features or labels on your map to only be visible at certain scales or to draw in different ways depending on the scale. The scale dependencies you set for your map layers and the scale levels you choose for your tiling scheme should be carefully coordinated. Any features to which you apply a scale dependency are useless unless your tiling scheme includes a scale level at which they are visible.
For example, if you have used scale ranges to reveal certain features when the user zooms in beyond 1:2,000, you do not want your cache's closest scale to be 1:2,500, or the user will never see the features. Adding a 1:1,250 scale to the tiling scheme would ensure that users could see the features. If you didn't want to add the extra scale, you could change the scale range so the features appeared when zoomed in beyond 1:3,000.
If you are responsible for caching a map that you cannot change, you can still design the tiling scheme to take advantage of the map's characteristics. If possible, open the map in ArcMap and examine the layer properties to determine if there are any scale-dependent layers and at which scales they turn on and off. If a layer does have a scale dependency, consider including a scale level in your tiling scheme at which the layer is visible. For example, if a layer is set to be visible between the scales 1:150,000 and 1:250,000, you can include 1:200,000 as a scale in your tiling scheme to ensure the layer appears in your cache.
Choosing a coordinate system
The data frame that you cache can use any coordinate system. However, if you will be overlaying your cache with another cache, you should use the same coordinate system for both. This also applies if you are overlaying your cache with tiles from an online mapping service. ArcGIS Online services, Google Maps, and Microsoft Bing Maps all use the WGS 1984 Web Mercator (Auxiliary Sphere) projected coordinate system.
Prior to ArcGIS 10, ArcGIS Online services used the WGS 1984 geographic coordinate system. These services are marked for retirement, and any new caches that you build to overlay ArcGIS Online services should use WGS 1984 Web Mercator (Auxiliary Sphere).
Planning layer visibility
By default, the caching tools will create a fused cache of your map. This means that all the layers in your map are cached in one image. Consequently, you can't turn layers on and off in a fused cache.
Fused caches are the default because they're fast. It's quicker for the server to get one image than to get many images. An alternative to creating a fused cache is to use a multilayer cache. In this type of cache, you can choose groups of layers in the map that will be cached together. However, this means that when clients use your cache, they need to wait for the server to retrieve multiple images, overlay them, and draw labels on top. Unless you are using ArcMap as a client, you will not get much performance benefit out of a multilayer cache.
So how do you keep the ability to turn layers on and off while using fused caches? In general, clients can overlay n fused caches faster than n layers in a multilayer cache. So one solution is to group related sets of layers in your map, then put each group in its own map document. Publish a map service and create a fused cache from each map document.
For example, suppose you have a map document with these layers: Banks, Restaurants, Museums, Libraries, Shopping centers, Parcels, Roads, Rivers, County boundaries, Lakes, Parks, and Elevation.
If you're just using ArcMap to view the document, you can turn these layers on and off at will. However, if you are going to publish this map on the Web using map caches, you'll want to combine some of the layers. Examining the layer list, you might come up with these three logical groupings from which you could make separate map documents:
Map document 1 (Points of interest)
- Banks
- Restaurants
- Museums
- Libraries
- Shopping centers
Map document 2 (Cultural landscape)
- Parcels
- Roads
- Parks
- County boundaries
Map document 3 (Physical features)
- Rivers
- Lakes
- Elevation
For each map document, you can create a map service with a fused cache. Be sure to use the same tiling scheme for each cache. Then you can overlay the three map services.
If you feel that there may be no need to view physical features separate from the cultural landscape, you could safely combine map documents 2 and 3 into one map document, thereby improving performance even more.
Anticipating cache creation time
When you create a cache for a map service, ArcGIS Server must render map images that cover the full extent of the area you designated for the cache at each scale level you indicated. In the case of a multilayer cache, it must repeat this process for each layer. Additionally, it must create the files and folder structure necessary to contain the cache.
The time needed to create the cache also depends on the scale levels you have chosen, the amount of server resources you have dedicated to building the cache, and the density of information in the map. Even using a powerful server, a large cache can sometimes take days or weeks to generate. In many cases, the performance benefit gained from using the cache still outweighs the long time necessary to create the cache.
Note: Although it can take a long time to generate the cache, you do not need to worry about the service timing out. The caching tools automatically adjust the service's maximum allowable usage time to a very high value before creating the cache. When the cache has finished generating, the caching tools set the maximum usage time back to its original value.
Choice of cache type
Cache generation will be completed more quickly if you use the fused cache type, which caches all layers together in one image. When you create a multilayer cache, the server makes a separate set of cached images for each layer. This means that each layer has to be rendered at all scale levels over the extent of the cache. The more layers you have designated, the longer it will take to generate the cache.
Choice of scale levels
When choosing the scale levels for your cache, remember that the closer you zoom in to the map, the more tiles are required to cover the map extent and the longer it will take your cache to generate. Every time you halve the scale's denominator, it takes four times as many tiles to cover a square area of the map. For example, a square map at 1:500 scale contains four times more tiles than a map at 1:1,000 scale, and a square map at 1:250 contains 16 times more tiles than a map at 1:1,000 scale.
To get an idea of how quickly the number of tiles in a cache can increase, open your map in ArcMap. Zoom out so that you can see an area of the map in a space about 256 pixels wide by 256 pixels high. (This area will vary depending on your display settings. Chances are it's 2.5–3.25 inches [6.35–8.26 centimeters] on a side.) At this scale, it would take one cache tile at default settings to cover the area. Now halve the denominator of the current scale. (For example, if you were originally viewing the map at 1:40,000 scale, zoom in to 1:20,000.) At this scale, it would take four tiles to cover the same area. Halve the denominator again, and it would take 16 tiles to cover the area. This table shows how the number of tiles needed to cover the original square area would increase with each halving of the denominator. The first scale of 1:32,000,000 can cover an area approximately the size of the western United States in one 256 by 256 pixel tile.
1st level |
1:32,000,000 |
1 tile |
2nd level |
1:16,000,000 |
4 tiles |
3rd level |
1:8,000,000 |
16 tiles |
4th level |
1:4,000,000 |
64 tiles |
5th level |
1:2,000,000 |
256 tiles |
6th level |
1:1,000,000 |
1,024 tiles |
7th level |
1:500,000 |
4,096 tiles |
8th level |
1:250,000 |
16,384 tiles |
9th level |
1:125,000 |
65,536 tiles |
10th level |
1:62,500 |
262,144 tiles |
11th level | 1:31,250 | 1,048,576 tiles |
Server resources
The more service instances that you have dedicated to working on the cache, the faster it will generate. In general, each CPU you have dedicated to caching can handle about three instances, although some CPUs may be able to handle more. See Allocation of server resources to creating a map cache for guidelines on how many instances to devote to caching.
Density of information in the map
The cache size and time needed to create the cache are both affected by the density of information within the map. Areas of the map with many changing colors and patterns will yield larger-sized cache tiles than more homogenous areas. For example, maps with high-resolution raster images will probably cause large tile sizes, not because of the original image size on disk, but because of the variation in color and pattern between the image pixels.
Similarly, maps that contain many layers and take relatively long amounts of time to render in ArcMap will typically require more time for creating a cache. This is because the server must repeatedly render the appropriate layers of the map as it creates the tiles for each scale level.
Map service drawing engine
Starting at version 9.3.1, ArcGIS Server contains an improved drawing engine that uses map service definition (.msd) files. When you publish your map using the Map Service Publishing toolbar in ArcMap, an .msd file is created and the fast drawing engine is used. If you publish your map in the traditional way using a map document (.mxd) file as the source, the faster drawing engine is not used.
MSD-based services tend to create tiles faster than MXD-based services. The time differential depends on the symbols used and the size and scales of the map.
Monitoring the progress of the cache
The Manage Map Server Cache Tiles tool contains a progress bar to give you an idea of the percentage of cache that has been completed. You can also view a cache's progress by opening Windows Explorer and noting how many files and folders have been created in your cache directory. Remember that the largest scales of your cache will take the longest to draw. The final layer alone could possibly take longer than all the other layers combined, depending on the scales you have chosen for your cache.
Preparing hardware
Caches can be stored on any machine in your GIS or Web server tier or on separate storage area network (SAN) or network-attached storage (NAS) devices. If resources are available, you can choose to dedicate one or more machines in your deployment solely for building and storing caches.
By default, the minimum space in which Windows can store a file (cluster size) is 4 kilobytes. If your cache contains many tiles less than 4 KB in size, you'll notice that the size the cache takes up on disk is much larger than the actual size of the files. To minimize this wasted space, you can use the compact cache storage format introduced at ArcGIS Server 10, or store your tiles on a disk or partition that has been formatted with a smaller cluster size, such as 1 KB or 512 bytes.
The best way to know whether many of your tiles will be smaller than the cluster size is to create a test cache of a representative area in your map and examine the resulting tile sizes. Types of caches that tend to have small file sizes and thereby may be best to store with smaller cluster sizes include the following:
- PNG 8 caches.
- Caches with scattered features designed to overlay a basemap.
- Caches with relatively small tile dimensions (256 x 256 or smaller). This includes caches designed to overlay Google Maps or Bing Maps.
- Caches with many empty tiles due to large scales, barren areas, or lack of data.
The above points about small file sizes only apply to the Exploded storage format. In contrast, the Compact storage format has been designed to save wasted space by storing the tiles in a continuous indexed stream of data. For more information, see Available map cache properties.