So you can get around in ArcGIS, huh? As you will see, you
have only just begun to tap its resources. As we have and will discussed in
class, one of the most significant powers of GIS (and ArcGIS) is the mix of G
(geographic or spatial data) and I (information or attributes or tabular data).
This powerful mix provides us with great analytical potential.
Tables
In
ArcGIS, Tables are generally the I that match up with our G.
As you've seen before, many of our layers include some tabular
attribute data. We can see this by clicking on Preview in ArcCatalog or opening
the Attribute Table In ArcMap. In
ArcMap when you select individual records, whether they are for points, lines,
or polygons, they should become highlighted in both the view and the table.
Plus, as you learned previously you can select records using the selection
tool, or the identification tool. When describing tables we will refer
to "records" and "fields". A record is all of the different
attributes for a single feature (point, line, polygon), and is contained in
a single horizontal row of a table. The fields are contained in vertical columns,
and each field represents a different attribute. In our states
layer, each record represents a different state and with fields containing
data like name, area, and identification numbers.
In
ArcMap add \\ad-rsc\data\teach\intgeo\ClassWork\avdata\usa\counties and states. Outline the counties with the state boundaries.
What type of information do we have for each state? For each county? Select
counties named Washington – how many are there. How many of the counties named Washington have a 2003 population
density greater than 10,000?
Note
the power you have at the tip of your fingers when you right click on the field
headings. You can now sort the table's
fields and create summary tables (worth exploring after class). For example, you can explore which state has
the most counties.
Information Overload – Relating and Joining
Did
you notice how little information we had about each of the states in our table?
How can we change that without typing in new data for each record? Answer:
Link or Join! Joining is the manipulation by which we appear to add fields
of data from another table to an existing table. This works really well when
we have a one-to-one match of our tables - a single record in the destination
table matches with a single record in the source table. In contrast, relating
is used for a one-to-many relationship (e.g. You have 10 wells in the county
that you sample each week. In your
.dbf table you make each sample a separate record so that after 5 weeks you
have five different records (many) for each (one) well.)
In relating tables, the tables are not actually combined but rather
linked such that when a record in your source table is selected the matching
record in the destination table is also selected.
Open the table for the states layer. Notice that it
does
have population by state but not income or gender.
Add the table located at \\ad-rsc\data\teach\intgeo\Classwork\avdata\usa\tables\stdemog.dbf. Notice that when a table is added to a map,
the table of contents (TOC) view switches from Display to Source. When the table is opened you will see that
it has lots of new fields, but also has the STATE_NAME and STATE_FIPS
fields
in common with the states layer. Notice how many records are in the
table? Is it the same or different
than in the states layer? Will
this give us a one-to-one or one-to-many match between our new demographic
table
and original layer table (states.shp)? Close
the stdemog.dbf file and in the TOC right-click on the states layer.
Select Joins and Relates, and then Join to bring up the Join dialogue
box. Fill in the boxes using the
STATE_FIPS field in both the state layer and in the stdemog table.
(Be sure that you are joining attributes from a table rather than
a location.) Hit OK. Now
look at the state layer table. Use your Layer Properties to make US maps
of
all sorts of demographic information. When you are done, remove all joins by retracing the steps in the TOC but clicking on Remove Joins stdemog.
Note: if you wanted to keep the layer
with the tables combined, you could save it as a new layer.
Still
in ArcMap, add the codemog.dbf table. Notice that there can be many county
records for a state while the state layer contains one record per state. This is an example of a one-to-many
relationship. If you were to ‘join’ the
codemog table with the state layer, ArcMap would find the first matching record
in the codemog table, join its attributes to the state layer and ignore any
further matching records. What to
do? We need to use a “Relate”. Close the codemog table and for the state
layer bring up the dialog box for Relating.
Carefully read and fill in the boxes in the dialogue box including a
name of your choosing and hit OK.
What? No change in
appearance!! Select a state – say
Montana. Open the attribute table for
the state layer and click on Selected to show selected records. Click on Options, Relate Tables and the
relate you just made. At the bottom of
the codemog table click on Selected to see the counties in Montana. We can also work backward by relating in the
other direction. For example, how many
counties are named “Boone”? One way to
find this is: in the codemog table,
click All to show all records. Try this
under Options, Select by Attribute.
Remove the Relate between states and codemog. Try relating the
states.shp with the counties.shp.
Editing Tables
Often
you will find that you need to add additional data in your database
tables.
·
In ArcMap, join the stdemog.dbf table to the states layer,
then open the states layer attribute table and export it to your home directory
as stedit.dbf
·
Start with the states layer
·
Add your stedit.dbf to the list of tables
·
Open that table
·
Under Options, add a Field called Und5perhh of type float and
with a precision and scale of 4
·
Right click on the field name for your new field. Populate the values for this by using the Field Calculator to divide the number of individuals under 5 years old in each state by
the number of household
·
Remove the join between the states layer table and stdemog
table, then join
your
edited
table
to
the
states
layer
table
Who would have ever thought we'd see that kind of spatial distribution?
If
you wanted to, you could type in new text values or numbers for every record.
You could add or delete a record or a field. But please, whatever you edit,
only do it to your own copies of files in your own directories. Remember
that the files
in \avdata\ are shared by everyone in the class.
Assignment 2
a.
Which state has the highest average family size?
b. Which county has the greatest total number and highest density of Asians (fieldname [ASIAN]) and American Indians and Eskimos (fieldname [AMER_ES])? Which has the least and lowest? Fill in the following table. We've provided an example to get you started. If there's more than one county with the same number or density, just provide the name and value for one county. Use a precision of 8 and scale of 2 for your density field, which should be of type Float.
| Total Number | Density (per sq. mile) | ||
| Asians | Highest | Los Angeles, CA - 1,137,500 | New York, New York - 5,180.19 |
| Lowest | Petroleum, MT - 0 | Greene, AL - 0.0 | |
| American Indians and Eskimos | Highest | ||
| Lowest |
c.
Using the county demographic data, develop a definition of ethnic diversity.
Using your definition, determine which counties have the highest concentration
of ethnic diversity and which have the lowest?
Make
a map, and explain how you derived your measure of ethnic diversity. We
don't care about how statistically or technically correct your
definition of diversity is, just be sure to explain to us how you
derived it.
d.
Which county is the largest and what state is it in?
Which state has the most counties?
e.
You are a single female and you want to increase the odds that you will find
Mr “Right”. You want to find a county
where there are more males than females.
Where are your odds the best? What
if you are 33 and you also want to live where there are more people in your
age range? Using any and all of your mapmaking tricks, create a map that shows the places which best meet both criteria.
Please
turn in the maps and the answers to the above questions on paper by the
start
of class on Monday, February 11 th. Be sure you name is on all pieces of unstapled
paper.