Paul Sobolak and Jinan Li Making Maps with More Automation in ArcView

Making Maps with More Automation in ArcView

Abstract: Desktop mapping and GIS are becoming common place in business today. As the user's awareness and knowledge increase, their demands become more focused, especially with regard to mapping output. While ArcView is a powerful desktop analytical tool, the user requires a number of helpful tools to easily and efficiently produce maps. This paper describes three such tools concerning the scale bar, character string manipulation, and fitting the view frame to the layout.


Introduction

Almost all Geographic Information Systems produce maps as a form of output. ArcView 2 lets the user make a quick map by printing the view directly. In addition, its Layout function allows people to produce maps with better quality. The user may want the map making to be more automatic and as easy as possible. This paper discusses some issues about the layout of ArcView 2 by using Avenue scripts to automate some aspects of map production.

Fitting View Frame

To produce a map with the geographic extent of a selected view, a view frame is needed on the layout. In ArcView 2, when you want to make a layout template, you need to decide the locations of the map components such as title, legend, scale bar, north arrow, and date. The most important decision is the location of the graphics. Usually, we need to draw a box around the graphics as a map boundary. It is reasonable to use this map boundary box as the layout view frame. However, ArcView puts the linked view into the view frame without adjusting the view shape to fit your view frame. In other words, there may be a blank area in the map boundary box. The blank area may appear on the top or the right edge of the box (Figure 1a).
Figure 1. Layout view frame fitting
The map boundary box cannot be fitted with the view properly when the ratios of Width/Height are different between the linked view and the boundary box on layout. That means additional work is needed before making a map. After the map boundary box is decided, you need to adjust the view shape to have an equal Width/Height ratio with the map boundary box. The script "aView.GetWin.Resize(W,H)" can complete this job (Figure 1b).

Manipulating Text Lines

A text string within a layout is a graphic symbol. If you would like to put a map title in a certain position (e.g. the top of a map) and especially to center the title, you need to do that manually. Different maps may have different titles. If title length exceeds the width of the area specified, the title needs to be broken into several lines. This task can be done automatically. The user types the title once, then runs the script outlined below to automatically create the necessary number of lines and center the text string appropriately. Figure 2 is a flowchart which shows the idea behind our ArcView application.
Figure 2. String Manipulation Flowchart
Suppose that the start position of the text string (or a map title) and the width of the desired area for printing the string are predetermined, then we are able to arrange the words in three steps. First, we need to know the size of each word in the text string in order to decide how many words can be put on a line within the designated area. Since all text on a layout are text graphic symbols, it is necessary to choose a font and size for the text symbol. By generating a text graphic symbol for each word and adding it to the layout graphic list, the size of each word can be determined. Once obtaining the size for all words in the string, the second step is to make the lines. The number of lines made depends on how many words are in the string and the maximum width of the desired space on the map. Each line of text is generated by adding one word at a time, and then checking the length of that line. The script automatically determines the required number of lines it must create. In addition to adding words to lines, a blank is also inserted between words. Finally, we need to decide the positions for all lines. The start position (x,y) of a line can be calculated by the upper left position (StartX, StartY) of the defined text display area and the height of the line. If the lines need to be centered, the line will be printed from the position at (StartX - Current line length / 2, y).

Optimizing Scale Bar

Map scale is one of the most important components of a map. Easy reading of the scale will increase the user's understanding of the map. ArcView provides a scale bar to represent scale for layout. The size and text of scale bar depend on the three settings: divisions, intervals and interval. Based on the ArcView Definitions, the interval is the width of one major division on the scale bar. Intervals is how many intervals are drawn to the right of zero. Divisions is how many smaller divisions are used in one interval to the left of zero (ArcView 2 On-line Help). Those settings can be changed by Avenue requests.

However, if you defined an area on the layout template for displaying a scale bar, the scale bar appearance will change when the scale of view is changed. The scale bar may extend off the map. The scale text may become strange. The text "0.13" or "17.533" may appear on your scale bar. Those kind of numbers are not user friendly when you use the scale bar to measure distances on the map. Esri provides a sample script "RoundScaleBarInterval" for a work-around with its scale bar problem. We used the aforementioned script, and received unsatisfactory results. While the script fixes the decimal points displayed on the scale bar, it does not necessarily produce a satisfactory scale interval. Our clients expect a scale bar to display friendlier unit intervals such as 2 mile, 5 mile or 10 mile increments. Therefore, we developed a method to display a scale for a desired area. The scale units is Miles no matter what kind of units is used by the view. That means that the units conversion will be done automatically.

When the size of the scale is determined, the total length of the scale bar representing real world distance can be calculated because the layout map scale can be derived from the view scale. The following pseudo scripts perform this task:

ViewWidth = aView.GetDisplay.ReturnVisExtent.GetWidth
LayoutScale = ViewWidth / ViewFrameWidth
ScaleBarLengthOnWorld = LayoutScale * ScaleBarLengthOnMap

ViewWidth is the width of the view graphics display which content is displayed in the viewframe of the layout. ViewFrameWidth is the width of the view frame of layout.

Based on the lengths of scale bar both on the map and in the real world, it is necessary to determine how many intervals you need. If an 11 x 17 map needs a scale bar with two intervals and two divisions, then interval is 2 * x, where

x = ScaleBarLengthOnWorld / 6

The next step is to round the x so that the x will be one of those numbers: 0.05, 0.1, 0.5, 1, 2, 2.5, 5, 10, 20, 25, 50 , 100, ... . Therefore, the number that appears on the scale bar will be one of these numbers: 0.05, 0.1, 0.2, 0.5, 1, 2, 2.5, 4, 5, 10, 20, 25, 40, 50 , 100, ... . When x is greater than 1, only the integer part of x is counted for rounding. For example, if x = 67.34, it will be rounded to 50.

Reference

1. ScaleBarFrame, Avenue Help, ArcView 2.1 On-line Help
2. RoundScaleBarInterval, Examples: Avenue Script Library, ArcView 2.1 On-line Help
Paul Sobolak
Associate/GIS Programmer
Thompson Associates
2929 Plymouth Road, Suite 200
Ann Arbor, Michigan 48105
Tel: (313) 665-9500
Fax: (313) 665-4934

Jinan Li
GIS Programmer
Thompson Associates
2929 Plymouth Road, Suite 200
Ann Arbor, Michigan 48105
Tel: (313) 665-9500
Fax: (313) 665-4934
E-mail: Geo_Li@emuvax.emich.edu