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