Contour Labels Made Not So Easy!
In previous posts we looked at deriving elevation contours and creating index contours for display. This time we look at the not quite so straightforward task of labeling our contours.
So previously we’ve covered how to derive contours from elevation data and then create some nice index contours. The last piece of this puzzle is labeling, which turns out to be a bit more challenging than one would hope, so let’s finish this off so we can move on to other topics. We’ll continue working with our nicest set of contours from our previous efforts.
Recall how I foolishly set my indices as ‘Bret’ and ‘Jemaine’. What was I thinking? Let’s start things off by labeling all my contours using the attribute values in the Contour layer. We get at the labels by going to Properties > Labels:
I’ve already set the Label Field to Contour. To turn the labels on I can tick the wee box at upper left: “Label all features in this layer” with this result:
It’s a bit of a mish mash and I can go a long way to improve these. First off, I’d like to change the font colour so that it matches my contours a bit better – that’s easily done from the Labels tab:
This is only a slight improvement. Next up I’d like to set my labels in the middle of my contours rather than all being horizontal. I can do this from the Placement Properties button on the Labels tab:
Notice that I’ve set the Orientation to “Parallel” and the Position to “On the line”. Here’s what I get:
Now we’re getting somewhere! One more little tweak and we can almost call it quits. See how the line goes through the label? To have the labels interrupt the contour line, I’ll create a “halo” around them. From the Labels tab click on Symbol:
Then on the next window, click “Edit Symbol”
And then click over to the Mask tab:
Tick the “Halo” button and adjust the size to your liking. Increasing the size makes the halo around the label wider (if only it were so easy in real life…). Here’s the result:
That’s looking nice, eh? A bit more professional. National Geographic, here I come.
Ah, but wait. Most topographic maps you’ll see only label the index contours, just to cut down on all the clutter. All is not lost – we can make use of our Index attribute values to only label the index contours. Back in the Labels tab, I’ll change the Method to “Define classes of features and label each class differently”
This adds some new options onto the tab, one of which is “SQL Query…” Those of you who love doing queries (and who doesn’t) will recognise the window that pops up when we click that button:
It’s our old friend the query window. We can use this to build a query to find all the contours where the Index value is “Bret”:
When we click OK and eventually get back to the map, here’s what we get:
Sweet as, bro. Now only my index contours are labelled and they sit nicely in line with the contours. I should probably leave well enough alone but there’s just one more tweak I’d like apply. Because labeling is such an important part of mapping, there’s (not surprisingly) a specific toolbar for labels. You get to it in the normal way of either right-clicking on the grey menu area and selecting the the Labeling toolbar or going to Customize > Toolbars and adding it. It’s deceptively simple looking:
There are several things about this toolbar I’ll ignore but the one I will focus on is the Maplex Labeling Engine. Turning this on gives you some more labeling options and a few that are contour-specific. Turn it on from the Labeling menu:
Selecting :Use Maplex Label Enginer” turns it on and gives us a few more options in the Labels tab, particularly with the Placement Properties, which now looks like this:
In this image you can see the different placement options and one specifically for contours. Again, lots of tabs and menus to delve into but we’ll keep it pretty limited. With “Contour Placement” selected, click on Position and you can see how we can choose different placements – I picked “Centered Curved”:
I also set it to use “laddering” from the Options button:
After ALL that…:
Well I hope that this isn’t too underwhelming after such a big build up – some very subtle changes have been made and I have to say that I’m pretty happy with the outcome.
NB: and it’s a pretty big NB: once we start adding other layers, we might well be getting some conflicts with other features. There are some conflict resolution options with Maplex that will help but if it starts getting complex, you may well end up manually placing labels, but let’s not even think about that one.
So over these three contouring posts we’ve covered a fair bit of ground. Starting from a DEM, we derived our contours, smoothed them to get a nice effect (good for mapping, not analysis!), then set up some index contours and finished off with labeling. Hopefully there are some other useful skills we’ve hit upon that can be used on many types of layers, not just contours.
Keep those cards and letters coming!