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.

This document contains four sections:

Planning a tiling scheme for your organization

Your organization may have several different base data layers that you would like to cache. When possible, it’s a good idea to select one tiling scheme and use it for all of the maps that you will cache. When you do this, you cache the same map area at the same scale levels for all caches. This facilitates map overlay, especially inside the Web ADF. 

When constructing a tiling scheme, the most important choice you will make is the number of scale levels and which scales you use. As you increase the number of scale levels, your cache’s required storage space also increases. However, using a large number of scale levels gives you a greater number of vantage points for exploring the map.

The Generate Map Server Cache tool provides you with some suggested scales based on the number of scale levels you choose and the extent of your map. These scales may be appropriate for your map; however, you will want to make sure that the closest scale reflects a level at which you want your users to view the map, and that you are willing to spend the cache creation time and storage space to accommodate the closest scale level.

Once you’re familiar with the cache creation process and are designing your own tiling scheme, you’ll probably want to pick your own scale levels. If ArcMap is available, you can get an idea of the needed scale levels by adding the map service, or viewing the original map document, at different scales. Take note of the largest and smallest scales at which you want people to view your map.

When setting adjacent scale levels, you can achieve a reasonable zoom increment by doubling the scale factor. This is how many of the tiling schemes on ArcGIS Online are configured. However, doubling the scale factor between scale levels is not required; you can use any increment that you want.

A simple way to create a tiling scheme is determine the closest scale at which your users will need to view the map, then double the scale factor until you reach a scale that would contain all of your area of interest in just one or two tiles. For example, if you were designing a tiling scheme for a city and the closest scale at which someone should view your map is 1:2400, your scale factors could be 2400, 4800, 9600, 19200, 38400, etc. until you reach a scale factor that would cause the entire city to be visible on your computer screen at once.

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.

You can ensure that your map is well-designed by applying scale-dependencies to labels and features. Examine the example cached images below from the ArcGIS Online StreetMap North America service. As the images 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 dependency to reveal certain features when the user zooms in beyond 1:2000, you do not want your cache’s closest scale to be 1:2500, or the user will never see the features. Adding a 1:1250 scale to the tiling scheme ensures that users will see the features.

If you are responsible for caching a map which 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 cache properties

The following tips can help you decide which input parameters to select in the Generate Map Server Cache tool.

Tiling scheme origin

By default the origin of the tiling scheme is set to the upper left of the coordinate reference defined by the map document. If no coordinate reference is defined in the map document, the upper-left of the two times the maximum of the union of extents of all the layers in the map is used. The extent of the active map frame of the map service will be always be cached unless the tiling origin starts within the map frame extent. In that case, only the extent within the space defined by the tiling origin will be cached.

Scale levels

When you create a cache, you can allow ArcGIS Server to pick the scale levels for you, or you can define them yourself.

When you choose the "STANDARD" scale option, ArcGIS Server picks the scale levels for you. It uses levels that increase or decrease by half from 1:1,000,000 and will start with a level closest to the extent of the source map document. For example, if the source map document has an extent of 1:121,000,000 and 3 scale levels are defined, the scale map service will create a cache with scale-levels at:

a. 1/128,000,000
b. 1/64,000,000
c. 1/32,000,000

The "CUSTOM" scale option allows you to define your own set of scales.

Tile output size

Choosing a smaller tile width and height may improve performance of the application requesting tiles from the cache, as less data will need to be transferred. However, smaller tile size results in a larger cache size and longer creation time. Because the default Windows disk block size is 4K, small tiles that may only be 1K in size will actually use 4K. A larger tile might be 4K in size and fit perfectly in a 4K block. Therefore, four 1K tiles use 16K on disk, whereas the single 4K tile only uses 4K on disk. With large numbers of tiles, this difference can become significant.

Antialiasing

Antialiasing is a graphics technique that blends foreground and background pixels near edges to trick the eye into seeing sharper borders. ArcGIS Server caching does not do true anti-aliasing, but does an approximation that works well with labeling and with line and polygon feature classes without textured fill. This approximation should not be used with raster imagery. The way ArcGIS Server performs antialiasing while generating the cache is by down-sampling a 4K by 4K pixel super-tile to a 2K by 2K pixel tile before cutting the tile into the smaller tiles requested in the tiling scheme. There is a small performance cost for using this option. If it is not needed for improving text and line clarity, do not use it.

Use caution with antialiasing if you are caching vector layers that will overlay a raster image. The data frame background color contributes to the color of the antialiased features. By default, the data frame background color is RGB 253, 253, 253 (almost white), which can cause antialiased features to appear lighter than intended, especially when placed over dark raster layers such as orthoimagery. For the most effective results with antialiasing, change the data frame background to a darker color that is unlikely to appear in the map, before you start creating the cache. Some software tools will allow you to find the average color within a given image, and this can be a good color value to use for your data frame background.

DPI

DPI stands for dots per inch and refers to the resolution of the cache tiles that the server will generate. DPI depends on the user’s screen resolution (e.g., 1024x768) and physical size (e.g., 19” diagonal). DPI can vary widely on client machines because of big screens (which lower DPI) and higher resolution screens and graphics cards (which increase DPI with higher settings). If clients will frequently be printing maps that include your cached layer, you may find it helpful to raise the DPI beyond the default, but be aware that this will increase the size of the files in the cache.

When choosing a DPI, the default value of 96 is usually sufficient unless you are working primarily on a network where the majority of your client machines have a different DPI.

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

When creating your cache, consider which layers constitute your base map. These are layers that are unlikely to change often and act as a background for the thematic layers of your map. Cache generation and display will complete more quickly if you used the fused cache option to cache all of your base map layers together.

When you create a multilayer cache, the server makes a set of cached images for each layer. When you display the map, the server must still blend together the tiles from each layer. The more layers you have in your multilayer cache, the longer the blending will take. If you attempt to use a multilayer cache with too many layers, you may lose the performance benefit of the cache. Additionally, the cache takes longer to create because each layer has to be rendered at all scale levels over the extent of the cache.

You may find it useful to test a small portion of your map with different caching scenarios to see if blending a fused cache with a non-cached service, or blending multiple fused caches, would be faster than using a multilayer cache.

Choice of scale levels

When choosing the scale levels for your cache, remember that the closer you get 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 divide the scale factor by two, 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 512 pixels wide by 512 pixels high. (This area will vary depending on your display settings. Chances are it’s about 5–6 inches (12.70–15.24 cm) on a side). At this scale, it would take one cache tile at default settings to cover the area. Now halve the scale factor of your map. (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 roughly four tiles to cover the area. Halve the scale factor again, and it would take about 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 scale factor. The first scale of 1:16,000,000 can cover an area approximately the size of the western United States in one 512 by 512 pixel tile.

1st level 1:16,000,000 1 tile
2nd level 1:8,000,000 4 tiles
3rd level 1:4,000,000 16 tiles
4th level 1:2,000,000 64 tiles
5th level 1:1,000,000 256 tiles
6th level 1:500,000 1,024 tiles
7th level 1:250,000 4,096 tiles
8th level 1:125,000 16,384 tiles
9th level 1:62,500 65,536 tiles
10th level 1:31,250 262,144 tiles

Server resources

When you create a cache, you can indicate the number of MapServer instances that you want to work on the cache. The more instances you choose, the more server resources will be dedicated to building the cache, and the faster the cache will generate. A good starting point is three instances per server object container (SOC) CPU. As you increase the number of instances, you will reach a point where you are utilizing the full power of your server and you will not gain any performance benefit until you add more SOC computing power to your system.

When you create a map cache from a service, the server extends the service's usage timeout so that it can work with the service for as long as necessary to create the cache. When the server is done creating the cache, it will restart the map service so the new cache can immediately be utilized.

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.

Monitoring the progress of the cache

If you’re waiting for a cache to finish generating, you can view its progress by opening Windows Explorer and noting how many files and folders have been created in your cache directory. Remember that according to the formulas above, the last layers of your cache will take the longest to draw. The final layer alone could possibly take longer than all of the other layers combined, depending on the scale factors you have chosen for your cache.