Archive for the ‘Map Production’ Category

Multi-line text in legends

Problem: You need to create a legend with long descriptions that wrap to more than one line

Last week I read the Strange Maps slideshow essay on Slate.com, and fell in love with the last map: Soil Map of the Central Far Side of the Moon. The interesting colors make it look like an abstract painting. I stared at it appreciatively for only a little while before I began to wonder what each shade represented.

This map is available from the USGS at http://astrogeology.usgs.gov/Projects/PlanetaryMapping/DIGGEOL/moon/1047/lfar.htm. Unfortunately, the .pdf file on that web page does not have accompanying explanatory text, either. I had to dig futher down to find it, spread between two separate pages: a chart that links color swatches to soil type codes, and a list that links soil type codes to full descriptions. If all of this information was displayed together on one page as a map and legend, it would be an even more captivating piece.

Producing such a legend for an ArcMap layout is kind of tricky. ArcMap does not, by default, handle color swatches along with multiple lines of text very well. What you would envision looking something like this…

…turns out looking something like this…

….with no line breaks, and no good way to create them. I arrived at the bad-looking purple legend item in the typical way you would think to make a legend. That is, I created an attribute table field for Soil Descriptions. I called that field “Desc_” and I copied the long text descriptions into it. Then, I symbolized by category on the Desc_ field. My symbolgy definition box looked like this:

You can already start to see the problem. The Label area is truncating, and that’s where ArcMap looks to get the legend text. Yes, you can double click in this area to edit the text, but you will not be able to enter line breaks.

One solution is to convert your entire legend to graphics, ungroup it, and start editing the text boxes manually. That will work, but then you will have a static legend that doesn’t update with changes to your map. Do it a couple times, and then have to remake your entire legend when you’re asked to add new items or use a different color scheme, and you won’t want to do it again.

The solution I will describe takes more time to set up initially, but will make your life easier later on. The answer is to make ArcMap take the legend text from a special Description area instead. The Description box will let you use line breaks! But, it is not available if you symbolize by category. It is only available if you use the “draw all features using the same symbol” option. Luckily, you can mimic the effect of symbolizing by category by using multiple versions of the same layer with definition queries applied.

So, to create a legend item for the lavender “It” soil that looks like the legend item for the brown “NpNt” soil, you would follow the steps below.

1. Add the soil layer to ArcMap a second time.

2. Create a definition query on the new layer so it only displays soil type “It”.

3. Symbolize all features with the lavender color.

4. Copy the soil description text into Notepad or any text editor, and enter line breaks where you want them. Ideally you’d do this for all your soil descriptions at once so you know they’re all the same width.

5. Bring up the Layer Properties, Symbology tab. Press the Description… button and copy the text from Notepad into the Description for Legend box.

Note that you cannot create line breaks in this box by pressing the enter key! But, any line breaks you have created in Notepad will be maintained by copying and pasting.

6. Go to Layout view and insert a new legend (or right click on the one that’s there) to bring up the Legend Properties. Go to the Items tab, select your newest entry, and press the Style… button.

7. Pick one of the styles that uses “Description” instead of the default “Label” for the swatch text.

Finally, it’s looking pretty good!

You can repeat the same process for as many legend items as you need. In the end, the legend will appear and behave just as if you had symbolized by category.

If you want to take a little more time, you can make it look even better. Most people envision these sorts of legends with the swatch justified with the top of the text. You can do that if you drill down a bit within the settings. Return to step #6 where you selected the legend item and pressed the Style… button. This time, press Properties… in the Legend Item Selector box that comes up. If you go the General tab you’ll see this:

Show Descriptions should be checked because of the changes you made earlier. Press the Description Symbol… button below it. Then, press Properties… again in the Symbol Selector window that comes up. Change the Vertical Alignment to Top.

That’s shaping up into one respectable legend. 2 soils down, about 25 to go. I’m half a mind to complete it just so I can stare at that map a little longer.

Tags: , ,

Saving symbology to use again

Problem: You have encountered or created some really nice symbols and want to stash them away for future use.

Sometimes it takes forever to get a symbol just right. And sometimes you’re looking at a map or layer file made by someone else and just love what they’ve done. In either case, it is not necessary to repeat the work, because you can save symbology definitions in a couple different ways.

The ESRI Streetmap package comes with a layer file that can be used to produce pretty maps from the data. In particular, I like the orange star symbol they use for state capitals.

In order to save it for re-use, I would follow the steps below. These same steps also can be used to save line symbols, fill symbols (for polygons), and font definitions (for text labels).

Bring up the Layer Properties, Symbology tab, and double click on the symbol to open the Symbol Selector. (For text labels you get to the Symbol Selector by going the Labels tab and pressing the Symbol… button). On the symbol selector screen there is a Save… button. If you press it, it will ask you to give the symbol a name and a category.

That’s really all there is to it! Your saved symbol will now appear at the top of the list of symbol choices. It will be there whenever you open ArcMap from now on, available for use like any other symbol. In addition, if you go to the Category drop down you will be able to see only the symbols in the category you just created. So, for instance, I could save all the ESRI Streetmap symbols I like, and give them that same category name to make them easy to find later. (Note: The new category may not show up right away, but if you open and close ArcMap it will be there next time).

So, how does ArcMap save these symbols and where does it look for them next time? It saves them into something called a .style file. Every custom symbol defintion that you save is stored in your personal style file, located in \ApplicationData\ESRI\ArcMap\username.style. The ESRI styles are stored in \Program Files\ArcGIS\Styles. Both your personal style and the default ESRI style load every time ArcMap does. You can access the other ESRI styles by clicking on the More Symbols button in the symbol selector.

Just like layer files, you can manipulate these style files and share them with others. I found a cool one that Brady Davis shared back in 2005 to use as an example. He created a style based on Google Maps. You can download it at: http://conversationswithmyself.com/181/ Once you unpack it, you can add it to ArcMap by pressing the More Symbols button and selecting Add…

You can get to all the new Google symbols by navigating through the symbol selector for different symbol types. But if you’d like to take a quick peek at everything all at once, that’s what the Style Manager is for.

You can open the Style Manager by going to Tools –> Styles –> Style Manager in the main ArcMap interface. You will see your personal style there, the ESRI default style, and any other styles that you may have added or turned on. Here’s how the Google style looks:

You can see from the folder names that you can control much more than just point, line, fill and text symbols with the style manager. Folders are colored yellow if they have something in them.

Also, with the style manager, you can create new styles, and copy and paste elements from one style into another. So, you could copy all your favorite symbols into you personal style. Or, you could create and populate a style specifically for sharing with others. You can also delete elements you don’t like to reduce clutter.

In addition, Tools –> Style –> Style References lets you pick which styles will show up in the symbol selector window. So, you could create an mxd that only references a custom style you have created, thereby limiting the user’s options to a list of standard symbols.

So, with just a little tweaking I used the Google style to googleize a section of downtown Richmond.

Not too shabby! That’s the power of styles.

Tags: ,

Controlling the placement and properties of text labels, Part 2

This is a continuation of my post about controlling labels. In the first segment I discussed reference scale, reducing clutter, and increasing font readability.

Now we turn our attention to the most complicated features, the roads. These are tricky because some have names and others have route numbers, and it is customary to symbolize those differently. Up to now we have only changed fonts for entire feature layers. Now we are going to have to use different fonts for different types of features within the same layer.

The way to do this is by using Label Classes. Change the label method from “Label all features the same way” to “Define classes of features and label each class differently”. Then Add two new classes, one called Names and one called Numbers.

Uncheck the box to label features in the default class. Then, press the SQL Query… button next to each new class to define a query that will distinguish it from the others. In this road layer, I noticed that the “Type” field is only populated for roads with names. It is left empty for roads with route numbers. So, I set my SQL Query to “TYPE” <> ” for Names (TYPE does not equal a blank space — indicated by the single quote). Then, I set my SQL Query to “TYPE” = ” for Numbers.

Note: Depending on the field type and data entry method, you will sometimes have blank spaces in empty fields, like I have shown above. Other times those empty fields will be <Null> instead. If the fields are null you have to use different SQL queries. They would be “TYPE” IS NOT NULL and “TYPE” IS NULL, respectively. You cannot tell which type of blank you are dealing with just by looking at the attribute table. (In fact sometimes you’ll even have a mix of the two types in the same field). The only well to tell is the press the Get Unique Values button when you are building your query.

Now that I have my classes defined, I’ll set up their label fonts. For the road names, I chose plain black at 7 points, placed above the line in Curved orientation. This makes them bend nicely along with the road.

Readability tip #3:
Although it is a tempting way to fit more labels in, don’t chose a font size smaller than 6 points. Your audience will not thank you if they have to take out a magnifying glass to read your map.

For the road numbers, I chose a highway shield. You can find these in the Symbol Selector by pressing the Symbol… button. I have found that the default shields are too big for my tastes. You can change their size by pressing Properties… and going to the Advanced Text tab. Then press the Properties… button under Text Background.

Now my map is looking pretty good.

We have pretty much reached the limit of what we can control with dynamic label settings. It is time to convert to annotation and add the finishing touches. Right click on each layer and chose “Convert labels to annotation.” Because we are working with shapefiles, we’ll need to store the annotation in the map document. You can save it into your geodatabase if you are working with feature classes. (Nifty, because it makes it portable). I like to check “Convert unplaced labels to unplaced annotation” because this will generate a list that lets me know if anything I wanted to label got skipped.

Once you have finished converting to annotation, you will have a map full of graphic elements that you can modify in exactly the same way as if you had added text from the drawing toolbar. You can select them individually or as groups, drag to move them, rotate, delete, change font settings, add line breaks, change wording, etc. When you are working with your annotation, be sure you have selected the correct target layer in your drawing toolbar. (This is especially important if are adding a new label).

You can go to Annotation Groups under Data Frame Properties to turn these layers on and off if you so desire.

I’d like to call your attention to one last thing in the finished map. The label for Jonathan Dikinson Park was too big to fit on top of the park, so I turned it into a “callout” — that is, I added a line from the label to the feature it is labeling.

Readability tip #4:
Do use callouts, but only when absolutely necessary. Don’t overuse them or your map will become a maze.

To create one, go to your Advanced Text, Text Background properties, and chose a callout from the Type menu.

For more on the aesthetics of label styles and other map elements, I recommend the book Designing Better Maps by Cynthia Bewer.

Tags: , ,

Controlling the placement and properties of text labels, Part 1

Problem: ArcMap’s dynamic labels don’t look good enough on your map

Labeling is one of the most time-consuming aspects GIS work, but it can also be one of the most fun, especially if you have an artistic eye for details. Knowing a few basic tricks can reduce the pain of the process and achieve a more attractive and readable end result. I will take you through the process of producing labels for a map of the everglades in Florida.

ArcMap does a respectable job of dynamically placing labels to use as a starting point. Here is how my map looks with dynamic labels turned on with all the default settings.

It is going to need work. I recommend breaking things down into steps. First, you’ll want to tweak the dynamic label settings to get them as close as possible to how they should look in the final product. As a last step you’ll convert them to annotation in order to make final nit-picky changes to get them just right. Keeping them dynamic until the very end will save you time in the long run.

But before you do all that, you will want to set your reference scale. This is the scale at which you will display or print your map. Setting one will make life incredibly easier because symbols and labels will be optimally sized to this scale, and, most importantly, labels will stay in the same place when you zoom in and out. There is nothing more frustrating than zooming in to precisely adjust pieces of densely packed annotation only to have them all shift position when you zoom back out. Reference scale saves you from this.

To figure out what your reference scale should be, switch to layout view and change the page size and orientation to those you plant to use in your final product. Place your data frame where it should be within your map template and zoom to the extent you want to display. Now look up and notice the scale. You’ll probably want to change it to the closest round number that produces a display window you’re happy with. For me that was 1:2,000,000. Go to your data frame properties and set your reference scale to that number.

Now, start adjusting your dynamic label placement settings with the easiest (i.e. the largest, most spread apart) features first. Here that’s the parks and water bodies (lakes and marshes). Turn labels for everything else off and then pick your fonts.

Readability tip #1:
Each feature layer should have its own font, so the map reader can more easily tell which label goes with which feature.

It is common to use blue italic text with water bodies. I picked bold dark green small caps for the parks. Now, you’ll notice that The Everglades is showing up all over the place, cluttering the map. This is because ArcMap defaults to placing one label per feature part for polygons. Switching this to “remove duplicate labels” in the placement properties will help.

A lot of what you will be doing is reducing label clutter. Forcing the label to only be placed inside the polygon would help dramatically with this as well (it won’t show unless it fits). For the parks, I have reduced clutter by changing settings on the Conflict Detection tab. I increased the label buffer to 10, which forces labels to be placed further apart. I also changed the label weight to medium, which reduces the chance they will show if the labels for other features are near them.

Here’s how it looks now.

Moving on to city points. These need to stand out on top of the busy road pattern. Adding a halo in a contrasting color will help a great deal. In order to add a halo, press the Symbol… button on the Layer Properties, Labels tab. Then press the Properties… button and go the Mask tab.

1.0 is a good size is most cases. Pressing Symbol… again will let you change the halo color. Black text with a white halo is most commonly used, but you can get creative. The key is have the halo contrast both with the background and with the text. I added a light grey halo to the parks because I wanted them to show up a little better but not stand out as much as the cities. I also increased the character spacing on the parks.

Readability tip #2:
If your labels are hard to read against the background, increasing the font size isn’t the only solution. You can also:

  1. Bold the font
  2. Use all capital letters
  3. Increase the spacing between the letters
  4. Add a halo or solid rectangle background (go to Advanced Text tab for this) in a contrasting color.

Next week: Part 2. I will cover label classes, annotation and call-outs.

Tags: , ,

Exporting maps to a specific pixel size

Problem: You need to create a map as a graphic with particular dimensions

Normally, maps are created to fit standard paper sizes. The default ArcMap layout is 8.5 by 11 inch paper, portrait orientation. However, the occasion may arise that you need to create a map not to print on paper, but to go onto a website, blog or wiki article. In such a case you wouldn’t be concerned about inches at all, but you may be concerned about pixel dimensions. For instance, all the images in this blog need to be 500 or less pixels wide, or they will leak over into the sidebar text. Other commonly used sizes are 800×600px or 400×300px. Of course, it is simple to export a map to an image and then resize it in any graphics program. Even MS Paint will do it. However, depending on the quality of the program you are using, the results won’t look as nice as they could. GIS Analysts aren’t considered graphic artists, so we don’t always have the best software installed on our office machines. Sometimes Paint is all we’ve got, and Paint can really mangle GIFs and JPGs. Luckily, there is a way to create your map on the right sized template from the very beginning, and export it to correct size with no need for that extra resize step.

First, when you are in ArcMap layout view, right click in the white “paper” area to bring up Page and Print Setup. Uncheck the Use Printer Paper Settings box to escape the hardcopy mindset. Now, you will be able to define a Custom size. One of the page units you can use is Points, which are related to to pixels. Here, I have entered settings that will produce a template I can use to export an 800 by 600 pixel image.

Once you have finished creating your map, go to File –> Export and choose your image format. Expand the Options screen so you can set your Resolution in dots per inch. This is where the relationship between points and pixels becomes apparent. A point is a typesetting unit that is equal to 1/72nd of an inch. So, if the output resolution is set to 72 dots per inch, then 1 point = 1 pixel. Now, this 800 by 600 point layout will became an 800 by 600 pixel GIF.

Tags: ,

Exporting PDFs and printing paper maps at the correct scale

Problem: Your scale text says 1 inch = XXX feet, but when you print out your map, 1 inch = something else.

It is rare you will be caught making such a mistake, because maps have to be set up in a particular way for it to be noticeable. But if it happens, it is quite disconcerting. I worked in an office full of engineers who asked me to create all maps with a scale of 1:a multiple of 12, so that 1 inch would be equal to a round number of feet. This way, they could take their engineer’s rule to the map and figure out exactly how long things were. At one point, one of them took that ruler to the scale bar, and saw something like this.

A ratio of 1:24,000 means that 1 inch should equal 2000 feet, just as the scale text says. However, the 2000 foot portion of the scale bar is not 1 inch long. Therefore, this map could not be used to make the measurements engineers like to make. If you are creating paper maps and you report the scale in any way other than just a scale bar, it is critical to avoid such distortion.

When I went to diagnose the problem, I found three places where this distortion can happen.

  1. When printing directly from the ArcMap Layout view.
    • Map will be distorted if you Scale Map to Printed Paper
    • Instead, you should Tile Map to Printer Paper
  2. When exporting to a PDF file
    • Map will be distorted if you Clip Output to Graphics Extent
    • Instead, you should make sure that box is unchecked
  3. Related note: If you start getting complaints that point symbols are showing up weirdly (for example, as exclamation points) in your PDFs, check Convert Marker Symbols to Polygons. Embedding document fonts should take care of this, but it doesn’t always work.

  4. When printing from a PDF file

Even if you correctly exported the PDF to scale,

  • Printout will be distorted if you Fit or Shrink to Printable Area
  • Instead, you should select Page Scaling: None

In all three cases, the correct option should be selected by default, but you need to double check. When printing anything other than a map, it makes sense to have the computer shrink or enlarge it just slightly so it fits to the page with nice even borders on all sides. It looks better that way. But it is deadly to maps! Any scale text on those maps will no longer reflect reality. Scale bars, however, are safe because they will change size along with the rest of the map, remaining correct. For this reason, I don’t recommend using scale text on maps that are exported to GIFs or JPGs and meant only to be seen on a screen. Their size will be changing all the time with differing monitor resolutions and zooms, so the only thing you can depend on is that scale bar.

Tags: , ,

Bad Behavior has blocked 21 access attempts in the last 7 days.