Appendix E

Tips and Tricks of ARC/INFO


Things to know before you start

 

One of the most important things to remember is that PC ARC/INFO does not use the same file setup that the UNIX and NT ARC use. If you want to use PC cover on a UNIX machine and vice versa, you must EXPORT the coverages. It is also important to note that the PC version of ARC is not as powerful as its counterpart on the UNIX and NT machines.

Following is an outline on the differences and things to consider when using the various versions of ARC. Then the basic processes that will be useful in your everyday work will be discussed. These are just some of the ways that have been used in the past and may not be the most practical and useful for your particular uses.

If you have not had much experience using ARC/INFO be sure to keep copies of these books nearby: If you are an Arc/Info expert then you already know to keep these books at hand.

 

Setting up your workspace in ARC

There are many "tricks to the trade" one might say when learning how to use Arc. There are many simple things you can do to help yourself understand how Arc operates. Below I will show you how to set some user specific variables for your workspace and how to create an aml that will set your workspace for you every time you start Arc from your workspace. I refer to Arc in the documentation below as a reference to ArcINFO, however, all these commands are available in GRID and only some are available in Arc.

Workspace Basics

Creating a Workspace

Create your workspace by making a new folder in your directory with the name of the project.

Once you are in Arc you need to move to your workspace. The following commands are equivalent:

&workspace c:\workspace

&wo c:\workspace

This is where all the coverages, grids and info files will be stored while you work in Arc.

 

 

Copying Files

To copy grids and coverages into Arc you must use the copy command. Attempting to copy files using Windows Explorer will not work. This is because every coverage and grid has files that need to be stored in the info directory. There is no way for you to tell which info files go with which coverage. Therefore ONLY copy files from one directory to another using the copy command.

Copy source destination

Viewing files in your directory

To view the files in your directory there are a couple of options. To view all the files in your directory use:

&sys dir/p

Notice that all the DOS commands are available after typing &sys

To view coverages type:

Listcoverages or lc

To view grids type:

Listgrids or lg

Deleting Files

Deleting files from your Arc workspace can only be done from Arc. Deleting files any other way will leave unwanted files in your info directory. To delete coverages or grids use:

Kill file_name

 

Renaming Files

To rename files use the command rename:

Rename old_name new_name

 

Advanced Workspace management

Setting and viewing aml and menu paths

To view the current aml or menupath which is the directory where your amls are run from use:

&show &amlpath or &show &menupath

To change these paths to another directory use:

&amlpath c:\path

When running an aml or menu Arc will first look in the atool directory, if it cannot find your aml there then it will search the directory you specify in amlpath or menupath. To have Arc search your amlpath or menupath directory first type:

&run aml_name or &r aml_name

&menu menu_name or &m menu_name

Or, if you want you can change the path to the atool directory using &atool.

Seeing your aml run with echo

One good way to debug your aml work is to turn on the echo. Echo simply prints on screen every command that Arc is processing. This way it is easy to identify where an aml goes wrong if it's not running properly. To turn on and off the echo use:

&echo &on

&echo &off

Setting workspace with an aml

You can have an aml automatically set your workspace every time you start arc from you own directory. When Arc is started it looks for a file called Arc.aml. If it finds that file in the directory it was started from it runs it. If you put your workspace path, amlpath, menupath and any other preferences you like in that aml it will set up your workspace for you. The aml that I have set my workspace looks like this:

&atool u:\atool u:\lwrogers\atool

&amlpath u:\lwrogers\amls

&wo u:\lwrogers\washougal

&menupath u:\lwrogers\menus

/* set terminal

&if [extract 1 [show display]] ne 9999 &then

&stat 9999

&return

 

The set terminal command is for running amls created in Formedit.

Good Luck!

 

PC Arc/Info 3.5

This version of ARC is less powerful than its counterpart on the other operating systems. This version is useful when

 

Windows NT Arc/Info 7.0

This page has a detailed description of how to use amls (arc macro language) in ArcINFO along with a few programming techniques that are helpful when programming in aml. Below, there are links to amls that I have written as well as descriptions of what they do and what the code in the amls is doing. Hopefully you will have learned something about programming in aml after reading this tutorial.

ArcINFO is a powerful map database management program used worldwide as the industry standard for Geographic Information Systems. One reason ArcINFO is such a powerful program is because it is easily customizable to each users needs. Two useful features of ArcINFO are the Arc Macro Language and Formedit. Arc macro language is an easy way to program commands into ArcINFO. Formedit is an expansion of AML and uses a windows based form to program in aml. Formedit allows user inputs while an aml is running and is capable of creating a Windows type environment for users of ArcINFO. My experience with AML's has been largely limited to the ArcINFO sub-program GRID so some of the commands listed in the following amls might not work when run in Arc.

 Here is what I have learned:

Document everything you do!

At the top of every aml include information about who wrote the aml and how to contact them, when it was completed and what variables it calls and returns. If the aml runs other amls, include that information also.

Use the following form for all comments when writing an aml: A /* denotes a comment line

/* Be sure to include more documentation then you think is necessary.

/* Make your code easy to understand so that someone later on can figure out what you were doing.

 

Writing Code and Setting Variables

The following are synonymous:

&setvar a := 3.14&sv a = 3.14&s a 3.14&s a := 3.14

All three set the variable a to a value of 3.14

Calling Variables

To call a variable that has been set place quotation marks around the variable name:

/* This command will take a grid, multiply it by a(3.14) and then create a new

/* grid of these values.

Newgrid = Oldgrid * %a%

 

Notice that to call or set a grid, no extra formatting is necessary.

Mathematical Expressions

Mathematical equations in GRID must be carefully constructed. The most important thing to remember is to leave a space on either side of an operator like * or +.

In GRID to raise a number to a power x^2 does not work. Use the pow(<grid | scalar | number>, <n>) expression instead.

Logical tests can be performed two major ways, one is with an &if statement the other is with con().

/* This logical test determines if the grid newgrid exists. If newgrid

/* does exist then it kills it, otherwise it skips to the next arc prompt.

&if (exists newgrid -grid) &then

kill newgrid

 

If you would like more commands to be executed if the test is true add the following:

/* This test determines if newgrid exists, then, if it exists, kills newgrid

/* and makes a new newgrid which is the oldgrid to the power of a(3.14).

&if (exists newgrid -grid) &then

&do

kill newgrid

newgrid = pow(oldgrid, %a%)

&end

The indentations are for ease of reading, they have nothing to do with the way the code is interpreted.

The con() statement is more for use in creating grids. CON (<condition>, <true_expression>, {<condition>, <true_expression>}, ...{<condition>, <true_expression>}, {false_expression})

/* This line of code creates a Shawn-Johnson table for mass wasting analysis,

/* slope is a grid. The ~ wraps the code to the next line, Arc reads this as

/* one line of code.

SJ = con(curve > 0, con(slope < 70, 3, 7), con(abs (curve) < 0.5, con(slope ~

< 47, 3, con(slope < 70, 7, 2)), con(curve < 0, con(slope < 15, 3, con(slope ~

< 25, 7, 2)))))

 

Basic Processing Skills

 

Files

There are three important files within the coverages that are useful to know about. The first is the AAT.DBF. This is found in line coverages and is able to be edited in INFO, EXCEL, and pretty much any text editor. The second is the PAT.DBF. This is similar to the AAT file but it contains the attributes for point and polygon coverages. The final is the TIC.DBF. This contains your XY reference system that everything else is based on.

Tics

Tics are small markers included in every cover that can be used to line up your maps. If the tics are known to be in the same location on two covers, the two maps can be overlaid on top of each other using the tics. Many of the covers that the DNR gives you will not have the same tics. You will need to make a uniform set of tics and place it in all the covers. This can be done by editing the tic.dbf file in Excel. Enter new XY coordinates so that the tics will make a uniform grid that covers your entire planning area. Note: Do not change the column width or add columns while you are in Excel.

New Covers

There are several covers that will need to be created to prepare for routine Arc/Info analysis. These covers can be made in Arcedit using the ADD command. If possible, use the digitizer to place new lines.

The DNR data that you receive will cover an area that is far greater than your planning area. In order to scale this down to a useable size, you will have to cut off the extra with the CLIP command. First, decide how big an area you want to work with. Then create a cover that contains only a box around that area. This box can be used as a "cookie-cutter" with the CLIP command. Remember that your planning area will be affected by some of the features that are just beyond the boundary. For example, a buffered stream may extend across the boundary, or you may want to view the road system beyond your boundary. Therefore, you will want to leave adequate space outside your planning area.

Someone will also have to create a cover that contains an outline of the boundary. This will be used to identify your planning area on maps. Since you will want this boundary to line up exactly with other land features, select those lines and place them in your boundary cover with the PUT command. For example, if your boundary runs along a road, edit the road cover, select only those lines that define the boundary, and PUT them in the boundary cover. Do this with the stream cover as well. Other lines can be placed with the digitizer.

A section line cover must be created. Annotate all the section corners with the section number (see maps from previous years). This annotation can be tricky. Take a close look at the ANNOSIZE command and all those other ANNO commands in Arcedit. Make sure your text size doesn’t change based on how closely you are zoomed in.

In order to make the 100 foot contours bold on topographic maps, you need to create a cover that contains only the 100 foot contours. BOLD.SML was written to do just that. You should run it twice so that you get one set of 100 foot contours and one set of 20 foot contours.

SMLs

The purpose of an SML is to automate any Arc/Info process that has to be repeated several times. They can be as simple or complex as you want to make them. There are often samples you can view in a text editor to give you ideas of some of the things you can do.

There are some SMLs located in the ARCEXE\UTOOL directory. These can be started without the full pathname. Take a look at SETKEY.SML. It can be used to add whatever commands you want to the function keys. It hasn’t been used in recent years, but it could speed up your work greatly.

Write your SMLs so that anyone can understand what they do. Be sure to write a good description of what your SML does, as well as your name and the date it was last updated at the top of the first page. Also, leave lots of &REM statements that explain what each section of your program does. Even if you don’t think your program is important, leave plenty of clues.

 

Processing

The most important and the most often screwed up Arc command is BUILD. If done incorrectly, this command will shuffle your data like a deck of cards. The BUILD command uses the user ID (displayed as: cover_ID) as a relateitem for creating the finished cover. However, some procedures such as the SPLIT command will modify only the new arc’s internal ID (displayed as: cover_ ). When BUILD encounters two arcs with the same user ID, it will incorrectly attribute them. To avoid this problem, calculate the user ID equal to the internal ID before building. This will be typed in Arcedit or Tables as:

CALCULATE cover_ID = cover_ - 1

Sometimes data will get corrupted even if you are careful, so make sure you have a backup copy before building the cover. It is also a good idea to check the validity of the data when you are through by viewing the cover in Arcedit. If you find that your type 1 rivers flow into type 5 streams, something got shuffled.

Another important command is CLEAN. If done with poor tolerances, you can lose whatever accuracy you had when you digitized. Also, making a polygon cover requires that CLEAN close all the gaps. A helpful command for finding gaps is DRAWE NODES DANGLE in Arcedit. It highlights the nodes that do not connect to another line, therefore gaps will have two dangling nodes. Before doing any analysis with the cover, check to be sure all polygons have a label. Otherwise, gaps are still present and fixing this problem later is not an option.

Analysis

In addition to being able to easily view data, Arc/Info also provides some powerful analysis tools. Unless otherwise noted, these commands can be started from the ARC prompt. If you would like more information, look in the Starter Kit or Overlay manuals.

The JOINITEM command (or the identical JOIN command in Tables) enables you to merge two sets of attributes into one, based on a common item called a "relate_item".

The FREQUENCY command can be used to sum the attributes of several covers. For example, you could use it to find the total number of acres of Douglas Fir in your planning area. Or you can find more complicated combinations, like the number of acres of Douglas Fir on a slope of 30% or less.

BUFFER creates a polygon cover that surrounds line features. For example, it can give you the 50 foot riparian buffer around a stream.

INTERSECT and IDENTITY are both used to combine two covers. Basically, they take two sets of general categories and create one cover with many specific categories.

The DRAWSELECT command in Arcedit is useful for viewing selected objects. By changing the line color with SETDRAWSYM, you can nicely display patterns of attributes. DRAW NOCLEAR and BACKCOVER can be used to display several layers of information. All these commands would be much easier to use if you made them available in SETKEY.SML.

Much of your analysis can be done in Microsoft Excel. Just open the PAT.DBF and AAT.DBF files inside the individual cover directory. However, it is very unwise to put a *.DBF file that has been changed back into the cover. Arc/Info doesn’t like unexpected changes. To avoid this, save the PAT or AAT under another name before messing with it in Excel.

Making Maps

Arcplot can be used to create any maps. MAP_MKR.SML should automate the process. However, the MAPEXTENT, MAPLIMITS, MAPSCALE, and PAGESIZE will be different for some maps. Once the map is set up, RESELECT and PLOT are the most essential commands. Remember that "PLOT COVER BOX * " allows you to place already created items such as keys, etc inside a selected space.

If a large area is being covered, the area can be "clipped" into covers. In order not to lose area, a reasonable amount of overlap should be accounted for. These clipcovers help keep files manageble and make it easier to cut the field maps for the area.

 

Creating A Latitude/Longitude Map

The small Trimble GPS units can only display lat-long, not a state plane coordinate system such as the DNR GIS data. These are general instructions for creating a latitude and longitude (lat-long) grid cover for use with the GPS units. This is the only reason that you may need to do this process, so you will need to determine if it is actually usefull to create maps with lat/long coordinates.

 

Procedure

  1. Create a new blank cover with only TICS in it.
  2. Use the PROJECT command in ARC.
  1. Determine the line increments. Basically the number of minutes or seconds between each line. This can be determined by looking at a USGS map and then determining what type of scale you will be plotting your maps at.
  2. In ARCEDIT
  1. At ARC prompt, add an item to contain the values of the Latitude and Longitude lines.
  2. In ARCEDIT or INFO, calculate the new items to contain the values of the line coordinates.
  3. Use the PROJECT command in ARC
  1. You now have a Lat/Long coverage that can be plotted with any of your other coverages.
  2. As an extra bonus, it is possible for you to add the STATEPLANE coordinates to the Lat/Long cover by using the nodepoint command in ARC. This creates a point coverout of the line cover. Then use ADDXY to create the values in the PAT.