Planning a map cache |
|
Release 9.3.1 |
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.
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.
This help topic will assist you in making good design choices when designing your map that will be cached. If you're designing a map that will overlay ArcGIS Online, Bing Maps, or Google Maps in a Web application, you should also read these topics:
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 ESRI StreetMap World service. 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 did't want to add the extra scale, you could change the scale range so the features appeared when zoomed in beyond 1:3000.
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.
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. The following guide will help you know which coordinate system to choose if this is the case:
Online mapping service | Coordinate system to use for your data frame |
ArcGIS Online | WGS 1984 (legacy services) or WGS 1984 Web Mercator or WGS 1984 Web Mercator (Auxiliary Sphere) |
Google Maps | WGS 1984 Web Mercator or WGS 1984 Web Mercator (Auxiliary Sphere) |
Bing Maps | WGS 1984 Web Mercator or WGS 1984 Web Mercator (Auxiliary Sphere) |
Using WGS 1984 Web Mercator (Auxiliary Sphere) can simplify datum transformations, but to create a cache from a map in this coordinate system, you must follow the instructions in ESRI Knowledge Base Article 37329.
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)
Map document 2 (Cultural landscape)
Map document 3 (Physical features)
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.
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.
Cache generation will complete 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.
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 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 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 roughly four tiles to cover the area. Halve the denominator 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 denominator. 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 |
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 Creating cache tiles for guidelines on how many instances to devote to caching.
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.
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.
Starting with ArcGIS Server 9.3 Service Pack 1, 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.
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 may 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 4k 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 store your tiles on a disk or partition that has been formatted with a smaller cluster size, such as 1k 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: