Some labels are better than others
In this post we look at some clever contour labelling to make your maps sparkly with masking.
We’ve been talking about map making in the GIS courses recently, which shouldn’t come as a surprise to anyone. Making effective maps to communicate your analysis results is an essential GIS skill. In one class we were looking at elevation contours and what they add to maps and got the point shown below for Quail Island:
I’m keeping this simple to illustrate a point but for now, I’ve chosen a colour and line thickness for the contours to roughly match what people are used to seeing on the 1:50,000 scale topomaps. Knowing that there’s an attribute called SPOT that has the elevation, it would be nice to label these so people know what each that is for each contour. Easy enough!
With the Contours layer selected in the Contents pane, I’ve got a Labeling ribbon available:
With the Field set to SPOT and clicking the Label button, they appear on my map:
Not ideal – I’d much rather have the labels set up the way they would normally be – with the label in line with the contour. Towards the right of the ribbon there are some preset placements for labels, with Contours being among them (it’s on the second row):
Let’s try it – straight away an improvement, but still not great – they’ve just been plonked straight on top:
I’d like to remove the line underneath the contour value, like you would see on the topomaps:
(In an earlier post we talked about how to only label certain contours.)
My first thought was that I’ll use Halos to create this effect. This will use Symbology to make a sort of buffer around each of the labels. I’ll make the halo the same colour as the background so it makes some space around each label:
(I cheated a little bit here – to get the colour exactly right, I used the Eyedropper in the Color drop down to match it:
)
That’s looking a bit more like it – until I turn on my Vegetation layer underneath:
That halo only works well when the background is always the same colour. There must be another way… There is! It’s a bit fiddly, but masking is a way to make this work. Masking allows us to hide other features in a layer where there’s an overlap. We’ve got three steps to make this work:
- Create an annotation layer from the labels
- Create a mask layer from the label annotations
- Use the mask on layers on the map
For most people, annotations will be a new facet of GIS. I’ll admit they are for me – I’ve always heard about them but never really knew what to do with them. The basic idea is that it takes the labels and converts them to a spatial layer in their own right, rather than then just being add-ons to a feature class. (Ed. that last sentence sounded like complete gobbeldy-gook, Just so you know…) They can be very useful in mapping. It’s easy to do – just right click on the layer with the labels and go to Convert Labels > Convert Labels to Annotations.
(The only thing I changed here was the name of the Output Layer.) Running this tool adds the annotation layer to the map which will basically be the labels.
Next, we can use the Feature Outline Masks tool on the label annotations:
(I set the Margin to 2 points and the Mask Kind to Convex Hull.) When this output is added to the map it will show areas similar to the halos. Turing it off so it’s not displayed now is a good idea – one more step to do. Here it gets a little tricky but I’ll try to be clear. The layer I want this to have an effect on is the contours, so I select that layer in the Contents pane. Then, under Feature Layer > Appearance, click on Masking in the Drawing group and tick the box for the masking layer:
As long as I’ve got the masking layer turned off, I get the effect I’m after – shown on the right below next to my original effort:
I’ve probably still got some placement issues to deal with but at least now I’ve got my labels nicely nestled within their contours and they’re not calling too much attention to themselves, so for now, happy days…til the next GIS problem comes along. I’m sure I won’t have to wait too long.
C