35
06/17/22 UT Dallas POEC 6382 Applied GIS Software 1 Database Management: Tables INFO and TABLES module Getting Attribute Data into Arc/INFO Modifying Feature Attribute Tables in Tables or INFO Inputting from and Outputting to External Files Modifying Feature Attribute Tables in Arc and ArcPlot Join and Relate tabular data

Database Management: Tables

  • Upload
    buffy

  • View
    65

  • Download
    0

Embed Size (px)

DESCRIPTION

Database Management: Tables. INFO and TABLES module Getting Attribute Data into Arc/INFO Modifying Feature Attribute Tables in Tables or INFO Inputting from and Outputting to External Files Modifying Feature Attribute Tables in Arc and ArcPlot Join and Relate tabular data . - PowerPoint PPT Presentation

Citation preview

Page 1: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software1

Database Management: Tables

INFO and TABLES module Getting Attribute Data into Arc/INFO

Modifying Feature Attribute Tables in Tables or INFOInputting from and Outputting to External Files

Modifying Feature Attribute Tables in Arc and ArcPlot Join and Relate tabular data

Page 2: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software2

Intro to Tabular Database Management• The information which describes and quantifies spatial features in the

ARC/INFO GIS is stored in INFO files and, optionally, in external database management system (DBMS) tables.

• INFO is a totally stand alone relational database management system exclusively dedicated to Arc/INFO.

• Each ARC/INFO module (Arc, ArcEdit, ArcPlot, Tables, INFO) provides some tools for managing and changing these tables

• There are two types of attribute tables: feature attribute tables and related tables. – Feature attribute tables are generated by the ARC/INFO software when

you create a feature class topology, and must be in INFO file format (discussed in depth in first lecture);

– Related attribute tables can be either INFO files or external DBMS tables.

Page 3: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software3

Review: Feature Attribute Tables• Types of feature attribute tables:

– Points - Point attribute table - PAT– Arcs - Arc attribute table - AAT– Polygons - Polygon attribute table - PAT

Each contain both internally generated topological data plus user defined attributes -- See Introductory lecture for data stored in each

• To look at data variables (items) in a feature attribute table:– Arc: items <cover>.pat or Arc: items <cover>.aat– Arcplot: items <cover> <feature_class>– Info or Tables: items (after having selected the feature attrib table)

• To look at data stored in each item– Arc: list <cover>.pat or Arc: list <cover>.aat– Arcplot: list <cover> <feature_class>– Info or Tables: list (after having selected the feature attrib table)

Be sure to note difference in usage for ITEMS and LIST between Arc and ArcPlot!!!!

Page 4: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software4

Sample Item Definitions• Example:Arc: items pub.pat

COLUMN ITEM NAME WIDTH OUTPUT TYPE N.DEC 1 AREA 4 12 F 3 5 PERIMETER 4 12 F 3 9 PUB# 4 5 B - 13 PUB-ID 4 5 B - 17 ID 8 12 F 0 25 NAME 25 25 C - 50 ADDRESS 15 15 C - 65 CITY 12 12 C -

• There are 8 items (variables). The first 4 are standard, crated by Info. The last 4 are user created.

Page 5: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software5

Understanding Item Definitions• An item (column) is described in terms of four variables:

– name - the name of the item, up to 16 characters in length• e.g. cover-id, landuse, pop97, etc.

– type - the data types used to store values • I - integer (one byte per digit)• B - binary integer (requires less storage than I types)• C - character• N - floating point (e.g. decimal) number stored as one byte per digit• F - floating point binary number• D - date (e.g. yyyymmdd)

– width - the width of the item in bytes required for storage• I - 1-16 bytes B - either 2 or 4 bytes• C - 1 to 320 characters N - 1 to 16 digits• F - 4 for single, 8 for double precision D - always 8 bytesFor F or N also provide the number of decimal places for real numbers

– Output width - the width of item values when displayed

Page 6: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software6

How do you know which item types to specify?• If the attribute values contain any non-numeric characters, you must

specify type C.• If the values are numeric with a decimal place, you must use N or F.

Storing numeric values as F (floating point binary) allows you to store large numbers in a small amount of space (4 bytes).

• If the values are numeric with no decimal, store them as I or B. Again, using B (binary) saves storage space.

• You can store numeric values as characters but you can’t manipulate characters arithmetically.

How do you know how much space to specify?• Define the item width for types C, I or N to accommodate the longest

value to be stored; unnecessarily long widths waste storage space.• Output width should be sufficient to display the longest character

string or numeric value. Always include one space for the decimal and one for negative sign.

Page 7: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software7

List• To look at data stored

Arc: list lulcsp.pat

1AREA = ************PERIMETER = 26829452.50LULCSP# = 1LULCSP-ID = 0LULC_CODE = 0LEVEL_I =LEVEL_II = 2AREA =12154654112PERIMETER = 3137822.500LULCSP# = 2LULCSP-ID = 21LULC_CODE = 21LEVEL_I = AGRICULTURAL LANDLEVEL_II = CROPLAND/PASTURE

3AREA = 11278215.000PERIMETER = 17881.912LULCSP# = 3LULCSP-ID = 41LULC_CODE = 41Continue?LEVEL_I = FOREST LANDLEVEL_II = DECIDUOUS FOREST 4AREA = 2316684.250PERIMETER = 6632.658LULCSP# = 4LULCSP-ID = 11LULC_CODE = 11LEVEL_I = URBAN OR BUILT-UPLEVEL_II = RESIDENTIAL 5AREA = 7348584.000PERIMETER = 12674.189LULCSP# = 5LULCSP-ID = 41LULC_CODE = 41LEVEL_I = FOREST LANDLEVEL_II = DECIDUOUS FOREST

Page 8: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software8

Reminder: File Structure• The INFO directory for a coverage is at the same directory level as the

coverage.• All coverages have several INFO files, the most common of which are

the feature attribute tables (.pat or .aat).• The coverage to which info files correspond is not apparent, therefore:

– Always use Arc: copy to copy coverages to another directory. Never use your operating system to copy coverages

– Always use Arc: copyinfo to copy INFO files which are not associated with a coverage. Again, these files are not identifiable with your operating system. To find their names use: Arc: dir info, or use dir in Tables or INFO

• However, you may also use or generate text files outside of the INFO database. You will only be able to see these (and copy or delete them) using your operating system (e.g. with Windows Explorer)

Page 9: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software9

Sample Data Management CommandsCOMMAND MODULES (usage will differ)

• ITEMS Arc, ArcPlot, ArcEdit, Tables, INFO• LIST Arc, ArcPlot, ArcEdit, Tables, INFO• RESELECT Arc, ArcPlot, ArcEdit, Tables, INFO• ADDITEM Arc, ArcEdit, Tables• DROPITEM Arc, ArcEdit, Tables• JOINITEM Arc, ArcEdit, Tables• CALCULATE ArcPlot, ArcEdit, Tables, INFO• MOVEITEM ArcPlot, ArcEdit (use MOVE in tables, info)• RELATE (series) Arc, ArcPlot, ArcEdit, Tables• SELECT ArcEdit, Tables, INFO• DIR Tables, INFO• DEFINE, ERASE Tables, INFO• MOVE Tables, INFO (use moveitem in arcplot, arcedit)• ADD, ADD FROM Tables, INFO• UPDATE Tables, INFO• ALTER, MODIFY Tables, INFO• REDEFINE Tables, INFO• KILL Tables, INFO• GET, OUTPUT, PRINT Tables, INFO• COPYINFO Arc• KILLINFO Arc

Always remember, check usage since it can differ between modules!

Page 10: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software10

INFO and TABLES• INFO and TABLES are two programs supplied with Arc/INFO for managing

attributes.– INFO is the main relational database management system for Arc/INFO. – TABLES also provides table management with a subset of INFO functions.

TABLES provides all the functionality needed for most database management tasks, and is a little easier to get into and out of and is less case sensitive than INFO.

• INFO is case sensitive and requires all parameters, data set names and variable (item) names to be typed in UPPERCASE

– Also, you are first prompted for “username”: specify ARC• No usage help available at the INFO prompt. Can enter “help” and the

command name, and get none-GUI help, or access ArcDoc from NT Programs menu.

• Both TABLES and INFO access the same data files.• Cannot use aml’s or watch files in Tables or INFO

Conclusion: generally use TABLES Do not forget, some table management and change is also done from Arc and

ArcEdit

Page 11: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software11

Comparison of Tables to Info• TABLES

– Create New Files– Add data– Display data– Extract data– Manipulate data– Stack relate files (ARC relate)– Create items– Redefine items– Limited changes to item

definitions– Undo changes– Use with AML transparently

• INFO– Create New Files– Add data– Display data– Extract data– Manipulate data– Stack relate files (INFO relate)– Create items– Redefine items– Limited changes to item

definitions– Use with AML through &data

block– Write reports– Program– Input forms for data entry

Page 12: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software12

Listing INFO File names• Files in INFO cannot be seen by name in your NT Explorer Window

-- they reside within the INFO folder with an internally generated name (e.g. arc0003.dat and arc0003.nit).

• You can list all INFO file names by using the DIR INFO command in Arc,

Arc: dir info

• in INFO or in TABLES this is abbreviated to just DIR.Tables: dir

• Be clear on the difference between dir info and lc (listcoverages)– lc simple names the coverages in your workspace– Dir info names all the INFO files in your work space including those

associated with a coverage – There are normally at least 3 INFO files associated with each coverage:

.pat and/or .aat, .bnd, .tic

Page 13: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software13

Internal and External INFO Tables

• INFO files can be internal or external. The terms refer to where the data are physically stored on your computer system. – INTERNAL FILES:

• Data located in a data file internal to the INFO directory:arcxxxx.dat contains the actual data

• Examples of Internal files– lookup tables– data files from somewhere else, not topologically linked to a coverage, but they

have been converted from original format into INFO file format

– EXTERNAL FILES • Data located in a data file external to the INFO directory:

arcxxxx.dat contains a pointer to the actual data in the form of a pathname• Examples of External files

– feature attribute tables (.pat, .aat, .nat)– coordinate tables (.tic, bnd)

• Both types are accessed the same way from within INFO or TABLES

Page 14: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software14

SELECT and RESELECT• In Tables and INFO, these commands generally must be issued before you can work on tables.

SELECT selects a file (table), and by implication all records within it. Any commands subsequently executed will affect all the records in the table. You must select a table in Info or Tables before you can work on it. To modify only specific records, use RESELECT to create a subset of records after you have issued SELECT to identify the table. SELECT <info_file_name>To clear selected table, issue SELECT without a name (you seldom do this, since normally you simply select another table.)

RESELECT (reduce select, or record select) selects a subset of records from the currently selected data file. (In INFO and Tables, you must have issued SELECT first to select this data file.) Selection criteria are based on logical expressions:RESELECT {BY | FOR} <logical_expression>RESELECT FOR ED-YRS LE 4 OR PAY-RATE GT 17.00

ASELECT adds additional records to the selected set -- requires a logical expression to select additional records.To clear a selection, use ASELECT without a logical expression to clear selection; in effect, this adds back all records in the file, thus clearing all previous selections.

NSELECT switches the set of selected and unselected records.

Page 15: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software15

Sample TABLES SessionArc: Tables (starts tables)Enter command: directory (will list all files, internal and external, within INFO)

Enter command: select pub.pat (you must select a file before operating on it)Enter command: items (will display item names in currently selected file)Enter command: list (will display data in currently selected file)Enter command: quit (will quit Tables and return to Arc prompt)

Sample INFO SessionArc: info ENTER USER NAME> ARC (must switch to all CAPITAL letters)ENTER COMMAND> DIR (abbreviation for directory)ENTER COMMAND> SELECT EDGEROAD.AAT (selects table)ENTER COMMAND> IT (abbreviation for items)ENTER COMMAND> Q STOP (to leave INFO)

Page 16: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software16

Getting Attribute Data into Arc/INFOStep 1: DEFINE a new INFO data file “template”to hold

the attributes; Data file must contain either

• the coordinate data needed to generate a new coverage, or • a variable that can be used to relate or join to an existing

coverage feature attribute table.

Step 2: ADD the attribute values to the INFO data file, either by

• entering each value at the keyboard, or • ADD FROM (or GET) an existing text file.

Alternate: Use JOINITEM or RELATE to “connect” an INFO data file to the feature attribute table for the coverage

Page 17: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software17

Step 1: Getting Attribute Data into Arc/INFO• DEFINE - Issue the DEFINE command with the file name to create a new

data file template. You will be prompted for the attribute name, size, and type of each item in a new data file.

Arc: tablesenter command: define landuse.datitem name: landuse-id (common name and definitions to matchitem width: 4 attribute table to which you wish to join)output width: 5item type: Bitem name: lu-code (new variable)item width: 3output width: 3item type: Iitem name: <return> (to end)

• If you make a mistake while defining the file, the command ERASE will delete the file, and you can start over. Or use ALTER or MODIFY.

• Look at what you have created with the ITEMS command.

Page 18: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software18

Step 2, page 1 Getting Attribute Data into Arc/INFO

Arc: tablesEnter command: select Landuse.dat (file

we created with the DEFINE command)Enter command: add 1Landuse-id> 59Lu-code> 400 2Landuse-id> 60Lu-code> 200 3Landuse-id> 61Lu-code> 400 ………... 6Landuse-id> <return>

• Sample table (LIST command)

Landuse-id lu-code

59 40060 20061 40062 300

63 100

ADD - use to interactively enter attribute data into an INFO data file

If any item values are wrong, you can use the UPDATE command to change the value of a particular record - works on one record at a time.

Page 19: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software19

Step 2, page 2 Getting Attribute Data into Arc/INFO

• You can use the GET or ADD FROM commands to read attribute values directly from an ASCII file or INFO file.

• Remember, when you are in INFO, you are in the /info folder. If reading an ascii file, you must indicate that the file is stored up one directory level.

• GET will put the data values from an existing file, which can be an ascii file, a binary file, or an INFO file, with fixed record length, fixed item length, into an empty INFO table that has been defined to match the ascii file field definitions.

enter command> GET ../airports.txt COPY (using INFO) tables> get airports.txt copy (using tables)

• ADD FROM requires an ASCII comma-delimited file, which may have been created with a system text editor, or by other programs such as spreadsheets or statistical systems. The items in the delimited data file must match the items definitions of the selected file. Character items containing blanks must be enclosed with a “double quote”.– Enter command> ADD FROM ../airports.dat– Tables> add from airports.dat

Page 20: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software20

Example using ADD FROM• Remember that you are in INFO and you must specify the full

pathname to the ascii file, or indicate a move up the directory path:

Arc: tablestables> SELECT LANDUSE.DAT (file previously created with DEFINE)tables> ADD FROM C:/USR/DLAUDER/DATA/LANDUSE.TABtables> LISTtables> Q

• The records are added to landuse.dat in the same order they were listed in the ASCII data file

• Landuse.dat can now be joined/related to a feature attribute table.• In the input file, text items containing blanks must be enclosed in

“double quotes” otherwise the blanks are also treated as delimiters and data is split among multiple items (this is not in ArcDOC!)

Page 21: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software21

Getting Attribute Data into Arc/INFO from a DBF format

• Database files (.dbf) can be converted from dbf to an INFO file format with a conversion command at the Arc prompt:

Arc: DBASEINFO <dbase_file> <info_file> {DEFAULT | DEFINE}

Arc: dbaseinfo air_data.dbf airdata

• After conversion to INFO format, the INFO file can be joined or related to the coverage feature attribute table.

• Remember, files in INFO cannot be seen by name in your NT Explorer Window -- they reside within the INFO folder with an internally generated name (e.g. arc0003.dat and arc0003.nit). You can confirm their existence by using the DIR INFO command in Arc, or just DIR in INFO.

Page 22: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software22

Modifying Item(Variable) Definitions in a File• MODIFY is used to replace (change), insert and delete item

definitions such as their name type or width BEFORE addition of data records to the template file. Must have an empty template--item definitions have been defined but attribute data has not yet been added (or all data records have been PURGED). R = replace

I = insertD = deleteL = list

• ALTER is used to alter item definitions such as their name, type, or width AFTER addition of data records to the file. Items must be empty to decrease column width or decimal precision.

• REDEFINE allows you to access contiguous items or parts of items in an INFO file as if it were another item. Items are formatted based on the columns (space holders) they occupy. This allows the user to view and manipulate the data in those columns as a new item.

Page 23: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software23

Modifying Record (item) Values in a File• UPDATE allows you to change the values of specific records for any item in the

currently selected file. UPDATE first prompts you for the number of the record to update. The current item values for that record are then listed, followed by an Edit? Prompt. To change a value, type the name of the item you want to change followed by an “=“ and the new value:

Enter record number: 2 (will list current values for that record)edit? soil_type = 30 (or soil_type = ‘clay’ if defined as character)edit? <return>Enter Record Number: <return>

• CALCULATE assigns new values for a numeric data item for the currently selected records (Tables: N, I, F, B, D; INFO: I, N, D).

enter command> calculate item_name = new_valueenter command> calculate item_name_2 = item_name_1 * value

Same functionality as CALCULATE in ArcPlot. Note spaces surrounding = sign!!• MOVE assigns new character data item (C) for selected records

enter command> move ‘new char string’ to item_nameenter command> move item_name_1 to item_name_2

For the same functionality in ArcPlot use MOVEITEM. (MOVE is very different in ArcPLot!)

• PURGE removes all selected records from a table (but item definitions remain--handy, for example, if ADD FROM screws up, and you need to try again). KILL deletes the entire file.

Page 24: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software24

OUTPUT• OUTPUT will output data from an INFO file into an ascii file• Must be done from INFO (not Tables)• When creating an ascii file, must precede the file name with the symbols to move up

one directory level ( ..\ ) to be out of info folder• If there are more than 999 records, INFO will insert a comma in the record number

(e.g. 1,000). To prevent the commas: enter command> CALC $COMMA-SWITCH = -1

• Example to create an output file with user-id and x,y coordinates that will be used to generate a point coverage:arc: INFO

ENTER USER NAME> ARC ENTER COMMAND> SELECT AIRPORTS ENTER COMMAND > CALC $COMMA-SWITCH = -1 ENTER COMMAND > OUTPUT ..\points.genENTER COMMAND > PRINT COVER-ID, ‘,’, LONG, ‘,’, LAT (adds commas also)

ENTER COMMAND > PRINT ‘END’ENTER COMMAND > OUTPUT ARC.NSP (directs future output back to normal default)ENTER COMMAND> Q STOP

Page 25: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software25

Coverage Generation• You can generate a new coverage from any comma-delimited ascii file that

contains a unique identification number (will become the <cover>-id variable, or user-id) and coordinate pairs for points, lines, or polygons.

• Prior to creating a coverage, determine if you would like single precision (coordinate accuracy to 3 decimals for geographic decimal degree) or double precision (coordinate accuracy to 6 decimals)

• EXAMPLE FOR POINTS:– Arc: precision double– Arc: generate airports– Generate: input airports.gen– Generate: points– Generate: quit– Arc:Remember to build topology after creation of a new coverage– Arc: build airports point

• Coverages are covered in more detail in the “Coverage” lecture!

Page 26: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software26

Managing and Changing Tables in Arc/ArcEdit/ArcPlot• Some table change and management can also (or must) be done

outside of Tables and INFO in Arc, ArcEdit or ArcPlot.• Some of the commands previously discussed for Tables and INFO will

also work outside Tables and INFO (altho exact usage may differ)• Material which follows provides examples of this

Page 27: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software27

Modifying item definitions in Feature Attribute Tables

• ADDITEM add an item to an existing tableADDITEM <in_info_file> <out_info_file> <item_name> <item_width> <output_width> <item_type> {decimal_places} {start_item}Example: Arc: additem pub.pat pub.pat relat-id 12 12 N 2 city- provides column and title only, no data is assigned- if the <out_info_file> is the same as the <in_info_file>, the existing <in_info_file> will be replaced

• DROPITEM drop an item from an existing tableDROPITEM <in_info_file> <out_info_file> {drop_item} Example: dropitem pub.pat pub.pat relat-id (to drop item relat_id)or dropitem pub.pat pub.pat (you will be prompted for names of all items to be dropped)

Page 28: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software28

Modifying numeric records in Feature Attribute TablesCALCULATE assigns numeric values to items. CALCULATE <cover> <feature_class> <target_item> = <arithmetic_expression>

or CALCULATE <info_file> INFO <target_item> = <arithmetic_expression>

Example: Arcplot: calculate pub point key = 1 Arcplot: calculate pub.pat INFO key = 1Example 2: Arc: tables Enter command: select aircover.pat Enter command: calculate air-id = aircover-id Enter command: quit Arc: list aircover.pat (to make sure variables correctly calculated)- Requires that item key has been defined as numeric - The CALCULATE command operates on all currently selected features within the coverage, or all selected records in the INFO file. This may be one, some or all records.

Note: there must be a space on each side of the equal sign: a = b

Page 29: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software29

Modifying character records in Feature Attribute Tables• MOVEITEM assigns a character value to a character item

MOVEITEM <cover> <feature_class> <’character_string’ | source_item> {TO} <target_item>

orMOVEITEM <info_file> INFO <’character_string’ | source_item> {TO} <target_item>

Example: Arcplot: moveitem pub point ‘blue’ to key Arcplot: moveitem pub.pat INFO ‘blue’ to key

- Requires that item key has been defined as character- Character strings are always placed in single quotes- The MOVEITEM command operates on all currently selected features within the coverage or records from an INFO data file: this could be one, some or all records in the file-use the command MOVE in INFO and Tables for same functionality as MOVEITEM in Arc and ArcPlot

Page 30: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software30

Merging Tables with JOINITEM • JOINITEM permanently merges two INFO data files based on a shared item

JOINITEM <in_info_file> <join_info_file> <out_info_file> <relate_item> {start_item} {LINEAR | ORDERED | LINK}

- The <relate_item> must exist for both files. - The <relate_item> must have the same definitions (i.e. name, type, width, output) in both files.-{LINEAR | ORDERED | LINK} specifies how <join_info_file> records are matched to <in_info_file> records.

LINEAR - both files can be sorted in any order. This is the default option.ORDERED - the <join_info_file> must be sorted on <relate_item>. LINK - The <relate_item> value in each record of <in_info_file> indicates the internal

record number in <join_info_file> which is to be merged. - The speed of execution will depend on the organization of the files being joined. In general, LINK is the fastest matching operation, then LINEAR with an indexed <relate_item>, and then ORDERED. The fastest option, LINK cannot be applied to most cases.

Hints: --use the LINEAR (default) option-- slower but safer --when adding attribute data to a coverage, the coverage must be the in_file --use same name for in_file and out_file--otherwise all the associated spatial files are not available.

Note: altho. we talk of joining tables, the command is JOINITEM. Do not use JOIN, which is a very specialized ArcEdit command used for joining lines on a map.

Page 31: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software31

Connecting Tables with RELATE• A RELATE temporarily associates data files based on a common item

occurring in two files. • Although a relate is temporary, the association between files can be

saved.• Types of relates:

– One-to-one relate - the values for the common item are unique in each file being related

– Many-to-one relate - many records in the main file may be matched to one record in the related file. Example: road types, lookup tables

• Command RELATE establishes or modifies the relate environment. Up to 100 relates can be stored in a single relate table.RELATE <ADD|DROP> add or drop a relate. Will enter a dialog to specify

properties -- see below. RELATE <RESTORE | SAVE> <info_file> bring back a relate from a

previous session, or save one for a future sessionRELATE LIST {relate} lists properties of either all the relates that are

current or just the relate you specify

Page 32: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software32

Creating a Relate Environment• RELATE ADD requires the following elements to be specified:

– Relation name: Name to reference the relate– Table identifier: The name of the data file (in INFO or other RDBMS) to which you

want to relate– Database name: Where the related files is stored (e.g. INFO)– INFO item: The item name in the feature attribute table that will be matched to the

relate column. These names do not have to be the same– Related column: The item in the related data file to match the INFO item– Relate type: Specify the search method: Linear, Ordered, Link– Relate access: Sets the access rights to the related data file. Can be Read/Write

(RW), Read-Only (RO), or the same as the current file (Auto)Arc: relate addRelation Name: sorelTable Identifier: soil (may need to specify full path name if other than current directory)Database Name: INFOINFO item: soil_typeRelate column: soil_typeRelate type: orderedRelate access: RWRelation Name: (starts over -- hit return to end addition of relates)

Page 33: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software33

Using the Relate Environment• The relate environment is usable from ARC, TABLES, ARCPLOT

and ARCEDIT. It is not usable from INFO.• Items out of related files can be used in Arc/INFO anywhere that an

item name is specified.• A relate does not store the table from which the relate operates;

therefore, multiple coverages can be related to the same data file• When using ADD, if a relation name already exists in the current set

of relates, it is replaced by the new relate with the same name• The general form for using fields out of related files is:

relation name//INFO item nameIf the INFO data file to which we created a relate named SOREL also contains an item called distance, we can create a distance buffer:

Usage: BUFFER <in_cover> <out_cover> {buffer_item}

Arc: buffer soils soilbuf sorel//distance

Page 34: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software34

Manipulating the Relate Environment• RELATE LIST

– Will list out all current relates

• RELATE SAVE <file_name.rel>– Creates a relate file (INFO file) that stores relates– Appends relates to an existing relate file– Each relate is one record in the relate file; can store 100 relates in one file

• RELATE RESTORE <file_name.rel>– Establishes the current (active) relate environment

• RELATE DROP <file_name.rel>– Drops a relate from all Arc/INFO modules– Will prompt for relation name to drop: typing $ALL at the Relation Name

prompt will drop all relates

Page 35: Database Management: Tables

04/22/23 UT Dallas POEC 6382 Applied GIS Software35

RELATE versus JOIN• Advantages of RELATE

– Operations on coverages with extended feature attribute tables take more time and machine resources.

– Can make the updating process easier and faster because it keeps descriptive data segregated from the spatial data. Can replace the attribute data regularly.

– Allows separate departments in an organization to access the same coverage while keeping their own descriptive data available in separate files.

– Relating data allows you to keep some of your data in another RDMBS, such as Oracle.

• Advantages of JOIN– Simpler for projects of small scope.– When files are joined, there are fewer files and relationships between files

to keep track of.