Introduction to Geographic Information Systems in Forest Resources
UW Home GIS@UW Search
Syllabus Schedule Class Meetings Assignments Course Data Internet Search

Current Grades

Contact Us CFR 590 Internet-only section Lab Locations  


Creating and Modifying Tables

Discussion

Tabular data in a GIS share the same importance as coordinate data. The strength of a GIS lies in its ability to manage data about spatial features, in addition to the position and location of the features themselves. In fact, in a GIS such as ArcView, a spatial feature exists as the pairing of the coordinate and tabular data.

In addition to representing the attributes of coordinate features, tables can exist in ArcView as objects separate from spatial features. Before the days of GIS, a large amount of data was created about spatial features, but without an explicitly locational framework. For example, the IRS keeps track of a large amount of data referenced by Social Security number and home address. Addresses are locations in a locational framework, but they do not have Cartesian coordinate values. However, using GIS software, it is possible to assign X, Y locations to addresses. Once we have an address and an X, Y location for a point, it is possible to link the taxpayer database to location by use of relational databases. Such data can be imported to a GIS and used in mapping and analysis.

Tables are used to represent spatial data as well as to analyze spatial data through simple statistics, data summaries, and as the source for charts. Charts help to visualize a large amount of numeric and categorical data in a way that is easy to understand.


 

Using ArcView tables
Creating tables from existing sources 
Creating a new table
Adding fields to tables
Adding records to tables 
Editing values in table records
Calculating fields
Querying tables
Displaying selected sets
Modifying selected sets
Basic descriptive statistics
Table summaries
Table relates
Record relationships among tables
Joining tables
Linking tables
Charts
Creating charts from tables
Chart elements
Chart types
Chart legends
Axis properties
Axis increments and grid lines
Switching series and groups


Using ArcView tables

Tabular data are stored on the file system in one of several file formats. In ArcView tables, are a graphical representation of these tabular data sources. This means that ArcView lets us view tabular data in a GUI. So in ArcView tables have their own GUI (menus, buttons, tools), and their own set of particular operations.

ArcView tables can come from a variety of sources, and multiple tables can be linked or joined based on common field values.

 


Creating (adding) tables from existing data sources

Tables can be created from many different formats of tabular data sources. Supported sources are dBase III and dBase IV, INFO (from ArcInfo), and comma- or tab-delimited ASCII files. The different formats available are chosen with a dropdown on the Add Table dialog.

Here, a dBase file is added to the project as a new table. Although the table is actually an attribute table that was created from a previous exercise, the table itself can be brought into the project as a stand-alone table, apart from the coordinate half of the feature theme.

 

Tables can also be created from queries on SQL databases, such as Access, Excel, Oracle, Ingres, Informix, SQL Server, and the like. Although these tables are not saved on the disk as files, a table created from an SQL query will be opened automatically if saved with a project. This example shows the results of a connection to an SQL (Access) database:

 

In all of these cases, regardless of the data source, the tables have the same look and functionality. The only important difference is that only tables from dBase or INFO sources can be edited within ArcView.

 


Creating new tables

A new table can be created much in the same way a new shapefile is created. When a table is created, a location on the disk and a filename must be specified.


The new table will be completely empty of both fields and records. When the table opens, it is automatically placed in edit mode.


After creating the table, you can add fields and records.

 


Adding fields to tables

There are 4 field types available in tables:

  1. numeric,
  2. string,
  3. Boolean (true/false), and
  4. date (stored as a special number in the form YYYYMMDD)

Before adding a field, you need to decide what type of data the field will hold. Then you choose a data type and field name, and if necessary, the number of decimal places. When you know how the field will be defined, add it to the table using the Edit > Add Field menu choice.



 

Fields can also be deleted from tables, if they are no longer needed or have been entered incorrectly. To add or delete fields, the table must be open for editing, and you must have write permission to the file storing the data. It is not possible to alter the properties of a field once it has been created, so you should think carefully about your field definitions before you create fields.

 


Adding records to tables

After fields have been defined, records can be added. Select Edit > Add Record or use the keystroke combination <CTRL-A>.

New records are added with blank values for string and Boolean fields, and zero for numeric and date fields.

Selected records can also be deleted from tables. Like fields, records can only be deleted if the table is open for editing.

 

Note: avoid adding or deleting records from a theme table. Doing so may corrupt your data, possibly irrevocably.

 


Editing values in table records

For tables that come from dBase and INFO tables, it is possible to edit field values. Tables that are sourced from ASCII files and SQL queries cannot be edited.

If the table is not open for editing, select Table > Start Editing from the menu. When a table is open for editing, the field names will appear in a block, non-italicized font. Thus, you can tell at a glance if a table is in edit mode.

Use the Edit tool to select a value to change. When you click on the cell containing the value to be changed, the value will highlight. Type in the new value. If you attempt to type in an invalid value (such as text strings within numeric fields), ArcView will not allow the change to be made.

Edits will not be written to disk until the edits are saved. If you close a table that was open for editing, you will be prompted to save or discard changes. If you attempt to close the project or ArcView, you will also be prompted to save changes to the table.

 


Calculating fields

To edit item values in bulk, it is possible to calculate the values in a field to a constant or an arithmetic expression. Expressions can include the values in other fields, constants, arithmetic operators, and any other valid Avenue requests.

To calculate a field, make the table editable, click on the field name (it will appear pushed in), and click the Calculate button . Use the Field Calculator dialog to write the expression.

In this example the new field is called Age_1998, and it is the result of subtracting the values from the field Est_year from the constant 1998.

 

If you include string (text) values in the calculations, you need to put quotes (") around the strings, e.g.,

[Common_name] ++ "Oncorhyncus keta"

will calculate the active field with the contents of the field Common_name and the string Oncorhyncus keta separated by a blanks space.

Calculations work on selected sets; if you have a selection of records and you make a calculation, the calculation will only be applied to selected records. If you do not have a selection, the calculation will be applied to all records.

 


Querying tables

Queries are used to select a subset of records. Selections can be made simply to view where features are located, to find out what other attribute values may exist for a selected set, or for use in creating new shapefiles or tables composed of a subset of the original theme or table. Queries are always built using the Query Builder dialog. You access the Query Builder by clicking the Query Builder button().

This query is looking for records of stands which are greater than 15 years of age, and also less than 30 years of age.

 

Queries can either be typed into the text entry control, or they can be built by selecting and adding fields, operators, and values with the GUI controls. In either case, it is important to use the proper syntax, especially when combining expressions to make complex queries. Queries are evaluated with standard mathematical rules from left to right, but logical order of precedence must be enforced by using parentheses (which are evaluated from the inside out). These two queries are not equivalent:

( [Age_1998] > 100 and [Area] < 5000 or [Perimeter] < 2500 )

( [Age_1998] > 100 and ([Area] < 5000 or [Perimeter] < 2500) )

Two wildcards can be used in queries:

Because dates are stored as numbers in the form YYYYMMDD, it is easy to perform queries on dates, treating them as numbers.

If you run queries against string fields, you also need to enclose the search string with double-quotes, e.g.,

[Latin_name] = "Oncorhyncus kisutch"

will select all records where the value of the field Latin_name is Oncorhyncus kisutch.

 


Displaying selected sets

When a selection is made on a theme table, the records in the table will appear highlighted in yellow.

 

If many records are selected, and those records are spread about the table, it is possible to pull all selected records to the top of the table using the Promote button . This does not change the internal order of the data, but simply alters the way the data are displayed.

 

In addition to the selected records being shown in yellow, selected features also appear yellow. For this reason, you should avoid using yellow in legend color schemes if you are using yellow as the selection color

 

The default selection color of yellow can be changed to any other color (select Project > Properties from the Project GUI menu, and click Selection Color).

 


Modifying selected sets

Three buttons exist in the Query Builder:

The New Set button will remove any selections that are active, and apply the query.

The Add To Set button will add records matching the query statement to the existing selected set. This usually increases the size of the selected set

The Select From Set button selects matching records from any existing selection. This usually decreases the size of the selected set.

These controls allow you to refine an existing query. If your initial query is too broad or narrow, you can alter the selection without needing to completely recreate the query.

 

There are three GUI buttons available for altering selected sets:

Those are, respectively, Select All, Select None, and Switch Selection.

 


Basic descriptive statistics

Selecting Field > Statistics generates basic descriptive statistics about the selected field. If there is any active selection, the statistics are derived only from selected records.

Here are the statistics for the Acres field, where stands of >70 years are selected.

 

This operation is so easy that it seems trivial; however, sometimes the entire reason for using GIS is to get summary data of this sort.

 


Table summaries

Records in tables can be summarized in many different ways. Summarizing a table creates a new dBase file on the disk, composed of the summary of the selected records in the active table (if no records are selected, the summary will apply to all records in the input table).

First, the field to be summarized is made active. The output table will contain a single record for each unique value of the active field. In this example, the field to be summarized is Soil.name.

 

Then, from the menu, Field > Summarize is selected.

 The summary statistics available are:

  • Average
  • Sum
  • Minimum
  • Maximum
  • Standard Deviation
  • Variance
  • First
  • Last
  • Count

 

The Summary Table Definition dialog is used to specify where on the disk the output file will be located, and what summary statistics are to be performed. Summary statistics are performed only on numeric fields. Fields are selected, along with the desired summary statistic, and then the Add button is pressed. You can add as many summary statistics as you like; this will simply add more fields to the output table. When you have added all the statistics you want, click OK. The table will be added to the project and written to disk. Following the example from above, the output table now contains only a single record for each unique soil name. Each soil name in the output table also has summary values for other attributes.

 

Summary tables are often linked or joined back to the tables from which they were derived.

 


Table relates

Frequently, there is a need for the use of external (non-theme-attribute) tables in GIS projects. A large amount of tabular data are available that have not been built specifically for spatially explicit use, but many of these data sets are able to be related to spatial data theme tables by the use of a common field.

The classic example is a municipal parcel database. First, there may be a parcels theme which only contains the Tax Assessor parcel ID number (PIN). The Tax Assessor's office will have database tables in a typical relational database system, where ownership, address, assessed value, and other fields are indexed by the PIN. Other data may be available that are indexed by the parcel address. Other data may be indexed by owner name. All of these tables can be imported into the project and related to each other by the PIN <-> Address <-> Ownership relationship.

Once the relationships between tables are established, cross-table queries, analysis, chart-building, and displays are possible.

 


Record relationships among tables

There are three basic relationships among tables: one-to-one, many-to-one, and one-to-many.

In the one-to-one relationship, values of records for a single field in one table match exactly the values for the same field in another table. An example of this would be a table containing basic stand attributes, including stand name, and another table indexed by stand name, but also with more data describing each stand. These records are related on a one-to-one basis.

 

In the many-to-one relationship, more than one record in the source table may have a common value with only a single record in another table. An example of this is a table containing stand attributes, including a species code. The related table contains species codes as well as full species names. Because there are many stands with the same species, there are many records with duplicate species codes, whereas there are only single records for species codes and names in the related table.

 

The third relationship, one-to-many, occurs where a single record in the source table shares values for a field with many records in the related table. Reverse the positions of the tables in the previous example, and you will have a one-to-many relationship.

To relate tables correctly, you will need to know the content of your tables, and which relationships are valid.

 


Joining tables

A join combines the records from two or more tables into a single virtual table. The new table functions exactly like any other table in ArcView, except that the files on the disk are not actually joined as a single file; the join only occurs within the ArcView project. A join appends records from one table to another table, based on the values in a common field. The common field does not need to have the same name or the exact same field definition (although numeric and string fields cannot be used as common fields).

Joins can be performed on tables with a one-to-one or many-to-one relationship. Although a join can be performed on one-to-many tables, the appended record will be the first match of the common field. For one-to-many relationships, use linking instead.

In the jargon, the destination table is the table that will persist after the join. The source table is the one that will be subsumed by the destination table.

To perform a join, make active the common item in both tables, and then make active the destination table. Click the Join button , which will append the records of the source table to the destination table. The values from the source table are added to the records in the destination table whose values match. The source table will disappear from the application desktop (though it will still be listed in the project window). Although the tables appear to change, the files have not; both the destination and source tables will remain on the disk.

Here, the species values (source) are joined to the stands attribute table (destination).

 

If there are no matches for values in the destination table with values in the source table, the resultant joined table will contain blanks for the appended fields.

When a project is saved, the relationship between tables is preserved, and when the project is opened, the join will be in place. To join more than two tables, the joins must be performed in a series of joins. To remove a join, select Table > Remove All Joins from the menu.

 


Linking tables

Links are used mainly to form relationships between tables that have a one-to-many relationship (although they can also be used for one-to-one and one-to-many relationships as well). When tables are linked, the source table is not appended to the destination table, but any selection on the destination table will also select related records in the source table.

When a link is performed, two attribute index files are created (shapefilename.ain and shapefilename.aix) which allow faster searching. The files are placed in the directory where the source table resides.

Here, the stands attribute table is linked to the species table with the common values in the fields spp and Species. When a record in the species table is selected, all records in the stand table with matching Species values are also selected.

 


Charts

Charts are pictorial representations of tabular data. Charts are easily understood and can communicate much more, and in a more compact format, than can tables.

In ArcView, charts are dynamically linked to the tables which store their data. When the source data change, those changes are automatically updated in the chart. When records are selected from the source table, the chart changes to show only selected data markers.

ArcView provides several different styles of charts, and gives you the tools to modify the style, legend, axes, units, and titles. Charts can be placed in map layouts to add impact and understanding to the map.

There are several drawbacks to ArcView's charting abilities.

 


Creating charts from tables

A chart is created from the active table. If a selection of records is made, the chart will represent only those selected records. If no selection is active, the chart will represent all records.. If the selection is changed in any way, the changes will also be reflected in the chart.

To create a chart, click the Create Chart button , which will invoke the Chart Properties dialog:

 

The Chart Properties dialog allows you to choose which fields to add to the chart (numeric fields only), and which field to use to label the series.

As mentioned before, it is not possible to create a chart from a large number of records. It is often customary only to chart summarized data, so in this example, a summary table was created from the stands attribute table. The summary field is species, and the summary statistic chosen is Sum_Acres. The chart is made to display one bar for each record, displaying the total area in each species type.

 

As you can see, Douglas-fir is far and away the leader of the pack.

 


Chart elements

Charts are composed of several elements, as indicated in the image below:

Each of these elements can be modified with the properties dialogs for each particular element. To open the properties for an element, click the Chart Element Properties tool and then click on the element itself.

These changes are possible:

Chart element colors can also be changed by clicking the Chart Color button . When this button is active, the color in the Color Palette will be assigned to any chart element you click.

 


Chart types

Depending on the nature of your data and what you wish to communicate, you can choose among several different chart types:

To choose between different types of charts, click the appropriate button in the Chart Type gallery .

 


Chart legends

Chart legend can be modified by selecting the Chart Element Properties tool and then clicking on the legend. This opens the Chart Legend Properties dialog, which allows you to change text labels and legend location.

To change series labels, click on the label text and enter the new text. To move the legend, click (do not drag) the location for the legend. Clicking the center of the chart makes the legend "float," so that it can be moved anywhere within the chart.

 


Axis properties

Axis properties are automatically defined by ArcView. However, these properties can be changed:

To change axis properties, use the Chart Axis Properties dialog, which is invoked when an axis is clicked with the Chart Elements Properties tool. The different axes have different controls in their respective properties dialogs.

groups-axis properties

values-axis properties

 


Axis increments and grid lines

For the axis which is displaying the data values, it is possible to add major and minor grid lines, to change the units, and to scale the minimum and maximum values, in addition to the other axis property controls.

Adding gridlines can make it easier to compare different values. Changing units and setting minimum and maximum scales can make it easier to read the data, especially if values are high.

 


Switching series and groups

Switching series and groups allows different comparisons to be made. In one case, comparisons are made between different records for the same field, whereas in the other case, the field values are compared for individual records.


Syllabus Schedule Class Meetings Assignments Course Data Internet Search

Current Grades

Contact Us CFR 590 Internet-only section Lab Locations  

 

The University of Washington Spatial Technology, GIS, and Remote Sensing Page is provided by the College of Forest Resources and the College of Ocean and Fisheries Sciences through Unit-Specific UIF. Site administrator: Phil Hurvitz.
Copyright © Phil Hurvitz, 1998-2003