Have you ever explored a map document and not found the information you were looking for? The table of contents tells what a feature symbol represents, but that alone may not provide enough information when map users are interacting with a map for a specific purpose.
To access the data associated with a feature, map users can open the layer attribute table or use the Identify tool. When a layer has a lot of attributes that are cryptically named, though, having map users wade through them is not ideal. Yes, you can turn off some table fields, set field aliases, and even create HTML pop-ups, but ArcGIS gives you an easier way to make a map more user-friendly: “smart” MapTips.
A MapTip is the text that pops up in ArcMap’s Data View when you hover your mouse pointer over a feature. The text is a value from the layer’s attribute table. By default, a MapTip displays the value exactly as it’s stored in the table. And while MapTips in ArcGIS 10.x actually have the same IQ as MapTips in earlier releases, you can be smarter about how you use them—because you can create expressions to customize MapTips.
- The ability to create label expressions in ArcMap has been in place for a long time. Creating an expression for a MapTip is the same thing. The example below shows how easy it is.
Create a Custom MapTip
Scenario: The map on the right shows child care facilities, hospitals, and emergency shelters in New Orleans on top of the Topographic basemap from ArcGIS Online. Suppose your job is to create emergency response plans to ensure the safety of children at child care centers in harm’s way. You need to know the number and distribution of the population at risk. You’re going to do an in-depth analysis, but first you want to do a quick visual exploration to understand the magnitude of the planning effort.
The Child Care Facilities layer already has a MapTip in place, the facility name. The name is useful information but you’d also like to display the maximum number of children potentially at a facility on any given day. You know that data is stored as an attribute, so it can easily be added to the MapTip by following these steps:
- Open the Layer Properties dialog box for the Child Care Facilities layer and click the Display tab.
- In the Field drop-down list, choose the field that you want to display first in the MapTip. In this case, [NAME] is already selected.
- Check the box next to “Show MapTips using the display expression,” then click the Expression button.
In the Display Expression dialog box, you build the expression to display the MapTip text the way you want. By default, VBScript is the selected parser. You can also use JScript or, if you have ArcGIS 10.2, you can use Python to build MapTip expressions as well.
- In the Fields list, click the additional field you want to see in the MapTip (in this case, [CAPACITY]), then click Append.
The CAPACITY field is added to the expression box and ArcMap automatically adds a space between the two fields (two double quotes separated by a space will create a space in the text; ampersands are used to connect each piece of the expression).
For easier reading, you want to display the MapTip text on two lines.
- In the expression box, click after the first ampersand, delete the quotes, then type vbNewLine.
Now when you hover over a child care facility on the map, you see two pieces of data in the MapTip and they each display on a separate line. This is what you want.
There are a couple of improvements you can make. Map users likely won’t know what the number means. You can make the MapTip more informative by preceding the capacity value with text that provides context. Also, the MapTip text is right up against the rectangle it displays within. It would be a nice touch to add some extra space on the left side of each line.
- Reopen the Layer Properties dialog box and click Expression in the Display tab.
- In the expression box, click just before the [CAPACITY] field and type “Capacity: ” & (be sure to type the space after the colon).
- At the beginning of each line, add a space using double quotes (” “) followed by an ampersand (&).
- Click Verify to make sure your expression is valid, then click OK. Click OK again twice to close the open dialog boxes.
Just like that, all the child care facilities have a readable MapTip that shows both their name and the maximum number of children that may be present.
MapTips are a property of a layer, so they are saved with layer files (.LYR) and layer packages (.LPK). The powerful thing about working with a GIS map is that you can access the data behind the map—the attributes associated with map features are right there, just waiting to be explored. MapTips can help you bring your data front and center.