Hands On
www.esri.com
ArcUser
January–March 2000 47
ArcView GIS
Adding Special Characters to Views and Layouts
by Krysha Dukacz, ESRI Technical Support
Assign pen symbology to polygon features
without having to convert them to polylines
using the script on the next page shown in
Figure 1. This script works on both themes
and graphics and allows any pen symbol
including dashed lines. Since a polygon is
really a fill symbol, applying a pen symbol to
the outline simply makes the polygon
transparent.
To use this script conveniently, attach it to a
button on the View GUI by following the
steps outlined below.
1. Type or copy and paste the code in Figure 1
into a new Script file.
2. Compile it by clicking on the Run button.
3. Choose Script > Properties and rename
the script View.PenSymbol or some other
You may need to include special characters
such as a registered trademark (®) or
copyright symbol (©) in text in a view or
layout. These characters are not accessible
through the standard keyboard. Use the
Character Map utility that comes with
Windows 95/98 and Windows NT to enter
these characters in ArcView GIS.
1. Launch ArcView GIS. Double-click on the
legend in the view to invoke the Legend
Editor. In the Font Palette portion of the
Legend Editor, select the desired font or
note the default font.
2. In Windows, click on the Start button and
choose Programs > Accessories >
Character Map or Programs > Accessories
> System Tools > Character Map.
3. In the Unicode Character Map dialog box,
select a font that matches the font selected
for ArcView GIS.
4. Find the special character.
5. Click on the desired character. The
Character Map utility will highlight the
character and display the appropriate
keystroke sequence in the lower right
corner. Note the keystroke sequence.
6. Return to ArcView GIS. In a view or
layout, select the text tool. While holding
down the Alt key, use the numeric keypad
to enter the key sequence in the Text
Properties dialog box. Release the Alt key
and the symbol will appear in the dialog
box. Click OK and the special character
should appear in the view or layout.
Typing keystroke sequences may be cumber-
some, especially if more than one special
character is needed within a single string. Use
copy and paste to speed the process or add
multiple symbols embedded in text.
1. Go back to Character Map utility and
select the desired character.
2. In the Character Map dialog box, click on
the Select button. The selected character
will appear in the Characters to Copy box.
3. Locate additional characters and press the
Select button to add them in the Characters
to Copy box. Text can be typed directly
into the Characters to Copy box.
4. When finished, click the Copy button to
save all the characters in the Characters to
Copy text box to the Windows clipboard.
5. Return to ArcView GIS. Select the text tool
and, in the Text Properties dialog box,
paste the string from the Characters to
Copy text box by using Ctrl+V.
Some special characters in some fonts will
display as the keystroke sequence in the Text
Properties box but will appear as the correct
symbol in the view or layout. For example,
using the Wingdings font to add an airplane
symbol produces the Q character in the Text
Properties box. However, after clicking OK,
the correct airplane symbol will appear in the
view or layout. Some of the special characters
may not appear at all in the Scripts window.
Make sure the fonts in ArcView GIS and the
Character Map match.
Add special characters to layouts using the
Windows Character Map utility.
Avenue
Assigning Pen Symbols to Polygons and Graphics
By Thomas Purk, ESRI Technical Support
appropriate name.
4. Invoke the Customize dialog box either
by returning to the view and double-
clicking on any part of the Button bar
without an existing button or by going to
the project view and selecting Customize
from the Project menu.
5. In the Customize dialog box, set the Type
to View and the Category to Buttons.
6. The existing buttons for the view
document will appear. Hit the New button
to create a blank button.
7. In the properties table below the buttons,
double-click on the blank line next to the
Click property. Choose the
View.PenSymbol script from the Script
Manager to attach it to the button.
8. To place an icon on the button, double-
Change a theme or graphic from pen to fill
using this script.
Continued on page 48
desktop notes
desktop notes
desktop notes
desktop notes
click on the blank line next to the Icon
property and choose an icon from the
Icon Manager.
Hands On
48
ArcUser
January–March 2000 www.esri.com
Assigning Pen Symbols to Polygons and Graphics
Continued from page 47
To use the new button
1. Select a polygon graphic and/or make a polygon theme active.
2. Run the script by clicking its button.
3. Select the symbol type, either Pen or Fill. The theme or graphic
will change to reflect the option selected.
4. Double-click on the legend to bring up the appropriate symbol
palette and select the new symbol for the theme or graphic.
These changes can be undone by rerunning the script and choosing the
opposite symbol type. Using this script on themes containing multipart
polygons (i.e., canada.shp in the sample data set) may result in
unusual display behavior. The display can often be corrected by
closing and reopening the view.
Figure 1
‘— This script changes the Symbol or Legend
‘— type of selected Graphics or Themes.
‘— Get the current View document
v = av.getactivedoc
‘— Return a list of selected graphics
theGraphics = v.GetGraphics.GetSelected
‘— Create a list only of selected polygon
graphics
theGList = GraphicList.Make
for each g in theGraphics
if (g.getshape.getdimension = 2) then
theGList.Add (g)
end
end
‘— If any polygon graphics are selected,
‘— prompt user to specify a symbol type.
if (theGlist.count > 0) then
theGChoice = (MsgBox.ChoiceAsString
({“Pen”,”Fill”},
“Select a Symbol Type for the Selected
Polygon Graphics.”,”Symbol Type: Graphics”))
if (theGChoice = “Pen”)then
theGSymbol = Symbol.make(#SYMBOL_PEN)
end
if (theGChoice = “Fill”)then
theGSymbol = Symbol.make(#SYMBOL_FILL)
end
end
‘— Assign the specified symbol to each
‘— polygon in the list of selected graphics.
for each pg in theGlist
pg.SetSymbol(theGSymbol)
end
‘— Return a list of active Themes
theThemes = v.GetActiveThemes
‘— Create a list only of polygon themes from
‘— the set of active Themes in the View
thePThemes = list.make
for each t in theThemes
if (t.getftab.findfield(“shape”).gettype =
#FIELD_SHAPEPOLY) then
thePThemes.add (t)
end
end
‘— If any polygon Themes are active,
‘— prompt user to specify a symbol type
if (thePThemes.count > 0) then
theSChoice = (MsgBox.ChoiceAsString
({“Skip”,”Pen”,”Fill”},
“Select a Legend Type For the Active Polygon
Themes.”,”Symbol Type: Themes”))
‘— Loop through the list of active polygon
‘— Themes and apply the user’s selection
for each pt in thePThemes
if (theSChoice = “Skip”)then
elseif (theSChoice = “Pen”)then
pt.setlegend (legend.make(#SYMBOL_PEN))
pt.updatelegend
elseif (theSChoice = “Fill”)then
pt.setlegend
(legend.make(#SYMBOL_FILL))
pt.updatelegend
end
end
end
‘— Force the View to redraw.
v.invalidate
‘— End of Script
Applying pen symbology to a polygon makes the polygon transparent.
Hands On
www.esri.com
ArcUser
January–March 2000 49
Finding the number of points in a polygon is
a straightforward procedure. Just aggregate
the polygon data and put the count in a
separate column. The following example uses
a geo file containing ZIP Code data
(zipcode.agf) and a geocoded point file
(managers.dbf). Follow the procedure
outlined here to find how many managers are
within a specific ZIP Code area:
1. Open the zipcode.agf and managers.dbf
files.
2. From the menu, choose Table >
Aggregate Data to bring up the Aggregate
Data dialog box.
3. Under the section Calculate Data For,
choose zipcode.agf from the drop-down
box next to Layer. Leave the Update
Selected Features box unchecked.
4. Under the Select Copy Feature Count To,
click on the New Table button.
5. In the New Table dialog, name the new
table Count.
6. Click the radio button next to Define New
Table and click OK.
7. In the Define Columns dialog, create a
column to hold the number of managers
in a ZIP Code and name it Count. Under
ArcLogistics Route
Importing an Excel Table
By Linda Schmidt, ESRI Technical Support
ArcLogistics Route can import data stored in an
Excel table as a Data Source Name (DSN). To do
so you must create a DSN file for the table and
select the driver in Windows 95/98 or Windows
NT 4.0. Follow the steps described here.
1. In Windows, go to Start > Settings > Control
Panel.
2. Double-click on the ODBC Data Sources icon.
3. Choose the User DSN tab and click on the
Add button.
4. In the Create New Data Source dialog, select
Microsoft Excel and click Finish.
5. In the ODBC Microsoft Excel Setup dialog,
enter a name for the data source in the Data
Source Name field. The description is
optional. In the Database section, use the
default value for the Version field.
6. Click on Select Workbook. Navigate to the
Atlas GIS 4.0
Finding the Number of Points in a Polygon
By Linda Schmidt, ESRI Technical Support
workbook location and click OK.
7. Click OK in the next dialog and close the
Control Panel.
Start ArcLogistics Route. Follow these steps to
import the Excel table.
1. From the menu choose File > Import Orders
or click on the Import Orders icon to invoke
the Order Wizard.
2. Select the Import Profile to use from the
drop-down list and click Next.
3. Select the Routing Folder to use from the
drop-down list and click Next.
4. Click the radio button for Use a Data Source
Name (DSN).
5. Click on the radio button for System or User
DSN and press the Browse For System DSN
button.
Import Excel data into ArcLogistics Route
using a DSN file.
6. Select the Excel table.
Complete the rest of the Import Profile process.
The Excel table will now be properly imported.
Type, define the data in this column as
Number.
8. Click the radio button next to Links to
Geo.
9. In the Layer drop-down box choose
zipcode.agf and in the Key Column drop-
down box choose ID. Click OK.
10. The program will return to the Aggregate
Data dialog box. In the Copy Feature
Count To drop-down box, choose the
newly created column called Count.
11. In the section Under Aggregating Data
DISCLAIMER
The user assumes all responsibility for use of
the sample routines as well as implementa-
tion of them to achieve the intended results.
The user is responsible for fully testing each
portion of the routine prior to relying on it.
This information is offered as a sample only,
and ESRI assumes no obligation for its op-
eration, use, or any resultant effect in spite of
this offer. This information and these sample
routines are provided on an “as is” basis, with-
out warranty of any kind.
Please remember to back up your data prior to
using this information.
From, choose managers.dbf for the Layer
and leave Selected Features Only box
unchecked. Leave Options at the default
setting of Aggregate to Nearest
Containing Feature.
12. Click OK.
You should now have a linked table showing
the new column on the right side of the
zipcode.agf with the number of points for
each ZIP Code polygon. This data can be
thematically mapped based on the number of
points (managers) in each ZIP Code area.
desktop notes
desktop notes
desktop notes
desktop notes
Atlas GIS 4 makes it easy to count the
number points in a polygon and place the
number in a separate table column.