Labels in map caches
In this topic
- How do I avoid duplicate labels in my cache?
- How does labeling affect tile creation speed?
- Should labels be maintained in a separate cache?
Many server administrators have questions about how map labels behave when the server creates map cache tiles. These include the following:
- How do I avoid duplicate labels in my cache?
- How does labeling affect the speed of tile creation?
- Should labels be maintained in a separate cache?
This topic provides guidance on each of the above questions.
How do I avoid duplicate labels in my cache?
During a caching job, ArcGIS draws large areas at a time to help reduce duplicate labels. These large areas (supertiles) are then divided into smaller, individual tiles. A supertile is 2048 x 2048 pixels with antialiasing or 4096 x 4096 pixels without.
You should not see any label duplicates within the supertile, but duplicates can occur at the supertile boundaries. This is because when a supertile is labeled, the label placement engine is not aware of labels on adjacent supertiles. In fact, your labeling engine may be making an effort to include as many labels as possible within a supertile, thereby placing some labels near the edge. It may do the same thing on the adjacent supertile, causing duplicates near the supertile boundaries.
The only way to avoid duplicate labels in a cache is to use annotation. Annotation is a special layer in which each label is treated as a feature with attributes. The attributes include an assigned place on the map for each label. You can edit an annotation layer to remove duplicate labels.
Creating annotation layers for map caches
Annotation layers can get very large, and creating annotation for all the various scales of your map may seem like a daunting task. Two tools in the Cartography Tools > Annotation toolset are designed to help you make annotation for map caches.
The first is Map Server Cache Tiling Scheme To Polygons. This tool reads a map cache tiling scheme and creates grids representing supertile boundaries at each scale of the tiling scheme. These grids help break up the annotation creation job into manageable pieces.
The next tool is Tiled Labels To Annotation. You provide the supertile grids you created, a map document, and an output workspace, and this tool creates annotation for every scale in your cache. Annotation is created for all layers in the map document that have labeling enabled.
The annotation produced by this tool gives you the same label placement you would get if creating a cache. You can then examine or query the layer for duplicate labels and delete them before you build the cache. Alternatively, you can manually clean up the annotation layer between cache updates as conflicts are noticed.
Before running the above tools on a large area, it's best to practice with a simple map using a small extent. Creating supertile grids and drawing annotation are time-intensive tasks, and you'll want to make sure you've supplied the correct parameters when you use the tools with a large map. Your practice session will also help you get a feel for how much time the tools may take and how much annotation they'll create.
How does labeling affect tile creation speed?
Computing the best locations for map labels can be a time-consuming process, and labeling can slow down your tile creation. Annotation is the fastest way to draw labels when caching because it requires no label placement decisions. Each label has predetermined coordinates that are an attribute of the label.
Using the default ArcMap labeling engine is the next fastest way to draw labels. A labeling engine has to make decisions about where to place each label, and the time this takes can add up if you have many labels.
Using the Maplex labeling engine is the slowest way to draw labels. Maplex offers more options, is more computationally advanced, and places more labels than the standard ArcMap labeling engine. Although Maplex offers good labeling, it can slow down map caching.
To achieve the best balance between good label placement and performance, use the Maplex labeling engine to draw labels in your map document, then convert those labels to annotation and use the annotation in your map service.
Caution:
Maplex can use a lot of memory. Before you use Maplex to build an entire cache, build a test cache and examine your system's memory usage while the tiles are being created. If memory usage is approaching your machine's limit, consider disabling Maplex. Failure to do so can lead to instability and possible crashes when creating tiles.
Should labels be maintained in a separate cache?
Vector features and their associated labels are usually included in the same cache. It's rare that you'll have a compelling reason to allow users to turn off the labels; however, isolating the labels from the features in separate caches is a good option if you need to do this.
Typically labels should not be included in caches of imagery. This allows the imagery to be used on its own or reused in other applications. Multiple imagery caches with different label sets "burned into" the tiles take up cumulatively more space on disk than one imagery cache with multiple label overlay caches.