Map caching for beginners

In this blog, we’ve presented several advanced techniques for map caching. If this blog were a book, we’d put the advanced information at the end, but we realize some of you may just be getting started with ArcGIS Server. If so, here’s your chance to learn what map caching is all about.

Map caching is a very effective way to make your ArcGIS Server maps run faster. When you create a map cache, the server draws the entire map at several different scales, then stores copies of the map images. The server can then distribute these images whenever someone asks for a map. It’s much quicker for ArcGIS Server to hand out a cached image than to draw the map each time someone requests it. Another benefit of caching is that the amount of detail in the image doesn’t noticeably affect how quickly the server can distribute the copy.

Why should I cache my maps?

With caching, the only time you pay the performance penalty for drawing the map is when you create the cache. For this reason, creating the cache might take a long time. However, the benefits of caching make up for the time it takes to create the cache. These are some of the main benefits of caching:
Performance: When you deploy cached maps, your users can get more done because they spend less time waiting for the map to draw.
Quality: With caching, performance isn’t affected by how much detail is in the map. It doesn’t matter whether you used shaded relief, or transparency, or the Maplex labeling engine to create your map or not. It’s all just a collection of images now, and the server can return one cached image in more or less the same amount of time it can return any other cached image.
Industry standard: Have you ever gone to a popular Internet mapping site and watched as the little square tiles fill in as you pan and zoom? Often, it takes just a second for all of the tiles to appear. That’s because they’re using caching. With ArcGIS Server map caching, you can achieve similar performance for your maps.

What happens during the caching process?

Caching does not happen automatically. To make a cache, you need to design the map, publish a service from that map, and then start the cache generation tool. You access the cache generation tools through the Service Properties in ArcCatalog. At 9.2, a Caching tab was added to the Service Properties dialog. This is where you can generate the cache.
When you cache a map, you draw it at more than one scale, so that users can zoom in and out of the map. The cache generation tool will ask you what scales you want to use for caching. If you’re just trying out the caching tools for the first time, you can let the computer pick some scales for you. However, you should usually pick your scales earlier so that you can design your map to look good at those scales. Write down the scales and use them as you do your cartographic design in ArcMap. When it’s time to create the cache, you can then enter the scales into the cache generation tool.
There are other properties that are important to understand when you create the cache. You can find out more by reading Planning a map cache in the ArcGIS Server Help.
The cache gets stored in your server cache directory. If you installed all of the components of ArcGIS Server on one machine, the install process created a server cache directory for you. If you installed ArcGIS Server across multiple machines, you need to create the server cache directory yourself. See Creating a server directory if you need help with this.
The scales that you pick and the properties you set for the cache are called the tiling scheme. Each cache has a tiling scheme file that you can import when you create new caches, so that all of your caches use the same tile sizes and scales. This can help the performance of your ArcGIS Server web applications that contain more than one cached service.

Can I cache all of my maps?

Whenever it’s appropriate, you should cache your maps to achieve the best performance. However, there are a few types of maps that do not work well for caching. Avoid caching maps that you’ll be editing and maps that change frequently. This is because the cache represents a picture, or snapshot, of the data that was taken at one point in time. If the data changes, you need to take another picture, or update the cache, in order to see the changes. There are tools for updating, but if you find yourself using them all the time it may be inefficient for you to maintain a cache.

Can I still get to the underlying data?

Although map caches represent pictures of the data, you still can allow others to perform identify, search, and query operations on your map service. These tools can get the geographic locations of features from the server and return the results. The application will draw the results in its native graphics layer format on top of the cached image.

What happens to my caches when I install a service pack?

When you install a service pack, your caches remain where you created them and you can continue to use them. When the service pack has finished installing, you’ll be prompted to run the post install. If you have very large caches, it may take the post install a long time to apply the necessary permissions to every file in the cache. See ESRI Knowledge Base Article 32766 for a way to work around this.
-Sterling Quinn

This entry was posted in Services and tagged , , . Bookmark the permalink.

Leave a Reply

7 Comments

  1. gena says:

    Hi !

    Can you plz add to this post some issues:

    -How different cache parameters affect the performance of the generation process?

    -What parameters (and how) affect the quality of the resulting cache?

    For example, if the quality of the cache image is very poor, what may cause it:
    symbology of the layer in mxd, size of tile, DPI value, type of display adapter, …

    Thanks.

    Regards,
    Gennady

  2. sterlingdq says:

    @Gennady- The topic “Planning a Map Cache” in the ArcGIS Server Web Help contains a discussion of different cache parameters and how to anticipate the creation time of your cache:

    http://webhelp.esri.com/arcgisserver/9.2/dotNet/index.htm#manager/publishing/planning_a_map_cache.htm

    In brief, antialiasing can increase the cache creation time, as well as choosing the multilayer cache type (fused is the recommended type). Also, the number of instances you dedicate to creating the cache makes a big difference. Your server computing power affects what you should set as this number.

    As for the image quality of the resulting cache, it should look pretty similar to your original map. You may notice some loss of quality if you are using JPEG image format for the tiles and you have vector data in the map.

    Sometimes it can look like you have lost image quality when you view the cached service in ArcMap. When this happens, it’s probably because you are not viewing the map at the scale at which it was originally cached. Zoom the map to one of the cached scales and it should look better. The reason for this is that ArcMap resamples your cached images to fit the scale you are viewing, and if your map portrays vector data, the resampled image does not often look as good as the original image.

    -SQ

  3. gena says:

    Hi !

    Thanks, I’ll learn this “Planning …” issue.

  4. sterlingdq says:

    gg7aph- This is interesting. Can you explain a little more about what these bookmarks are in your web app? Are you jumping to a certain extent on your map programmatically? If so, what call are you making to get the map?

    -Sterling

  5. azdroik15 says:

    I’ve read that you can overlay a map cache on top of another map cache or use a map cache and non-cache together. I guess I’m not sure why this would be useful instead of having just one map cache. Could you please give some examples as to why someone would do this?

  6. sterlingdq says:

    azdroik- There are several reasons you might not want to include all of the layers in one cache. First, some of your data might change so often that it would not be worth the effort to create and maintain a cache. You could cache all of your other layers together and leave the changing, or dynamic, data as a non-cached service.

    Another reason to create multiple caches is so that you can turn layers on and off. When you create a cache (of the default type “fused”) all of the layers are included in one image and cannot be turned on and off. However, if you overlay two fused caches, you can turn those two layers on and off. In this case, the fused caches would act like group layers.

  7. sterlingdq says:

    @Borja- You can mix cached and non-cached services in an application. The reason most people do this is that they have some data that changes frequently that they need to see in real time.

    You can still perform queries and identifies on cached services. The query or identify operation accesses the back end data on the server.