DataEntry Lab 02F
DataEntry Lab 02F
GIS software, with its ability to associate data with map layers, is well suited for production of
thematic maps. Data for thematic mapping comes from a variety of sources, including state and
federal agencies. While much geographical information is distributed as shapefiles (with
associated data tables), it is not always available in this format.
In the Base Map exercise, you learned one method of creating a map layer when no such layer
previously existed. In this exercise, you will learn how to bring data into a shapefile which can
then be used for thematic mapping.
• Start ArcMap (Start All Programs >ArcGIS >ArcMap); if there is an icon on the
computer desktop, you can start ArcMap by double-clicking it. You will be shown a
window asking whether you want to open a new empty map, a template, or an existing
map.
• Make sure the An existing map: radio button is selected and click OK. If you did not see
this window, click File >Open.
• Browse to where you saved the DataEntry.mxd project file and open it. You will have a
data frame called Wyoming. You should see two layers: the State outline and Counties.
When adding geospatial data (data with geographical properties) to ArcMap, you work with
attribute tables. Attribute tables are organized in rows and columns. In ArcMap, the rows are
referred to as records while the columns are referred to as fields. Records are geographical
features like counties, states, census tracts, roads and rivers. Fields are used to describe a
particular characteristic of that feature. For example, a dataset for counties of the United States
may include the following fields: county name, State name, and population.
Figure 1 shows this organizational structure for a hypothetical attribute table for counties in the
Dallas, Texas metropolitan area.
1
Figure 1. Records as rows, Fields as columns.
• In this exercise, you will be working with the attribute table for the Counties layer of
your project file. To view it, right-click Counties in the table of contents and then
select Open Attribute Table. A new window will open with the following table.
You can manipulate the display properties items within an attribute table in ArcMap. For
example, you can:
✓ To change the width of a column…
o Position the mouse pointer at the right edge of the heading (field name) of the
column you want to resize.
o When the icon changes (see image at right), click and drag the edge to
the desired width
✓ To rearrange a table’s columns…
o Click and drag a column’s heading (field). A red line indicates where the column
will be positioned. Release the mouse button to place the column in the new
position.
✓ To freeze or unfreeze a column…
o Click the heading of the column you want to freeze
o Right-click the selected column’s heading and click Freeze/Unfreeze Column
to freeze the column
o The frozen column will move to the leftmost position in the table and stay in place
when you scroll to the right.
o To unfreeze the column, repeat the previous steps.
✓ To hide a column…
o Right-click the layer (or table) in the Table of Contents and click Properties.
o Click the Fields tab. Here you can set whether a field is visible or not.
2
There are several ways to get data values into your attribute table. You can manually enter the
data by adding a new field to the table and typing the data values. You can load a data table in a
format that ArcMap can read and link that table to the shapefile through a process called joining.
You can also use ArcCatalog to manipulate tables (this method will not be covered in this
exercise).
Let’s start by employing the first of these methods. Below is a data table showing the land area
in square mile of the various counties in Wyoming. You will need to add a field to you data
table and then manually enter in the values listed below.
• Click the Options button in the lower right-hand corner of your data table and select Add
Field. A context window will appear.
• Name the new field Population. In ArcMap, a field name may not be longer than thirteen
characters and can have no spaces or special characters (#, %, &, etc.). You may use an
underscore.
3
Figure 4. Adding the Population field.
There are six field types available to you in the Add Field dialog: Short Integers, Long
Integers, Floats, Doubles, Text, and Dates.
• Short and Long Integers. If your data values are all whole numbers (i.e., no numbers
to the right of the decimal place), use Short or Long Integer. The precision of the
field refers to width, in digits, of the number (e.g., a precision of 6 would allow for
numbers between -99999 and 999999. The negative sign counts as a digit). If you
leave precision at 0 (the default), you can have numbers up to four digits wide. The
maximum you can have is 19 digits (even if you make your precision higher than 19).
• Floats and Doubles. Unlike integers, floats and doubles allow for numbers to the right
of the decimal place. As with integers, precision refers to the width of the field
(including the decimal place). Scale refers to the number of decimal places. Thus, a
precision of 6 and a scale of 2 will allow you to enter numbers between -99.99 and
999.99.
• The difference between Short and Long Integers and between Floats and Doubles is
in how the data types are stored. Please refer to the ArcMap help menu for more
information on these differences.
You are now ready to add the data values. Even though you have added the field to the data table,
you cannot enter the data values yet. In order to do this, you need to be in the edit mode.
• Make sure the Editor toolbar is visible. If it is not, turn it on (Tools >Editor Toolbar or
press the Editor Toolbar button on the standard toolbar).
• On the Editor toolbar, press the Editor button and then select Start Editing.
Note that the counties listed in the earlier table are in alphabetical order, but the counties in your
attribute table are not shown in this order.
4
• Right-click the County field name in the table and select Sort Ascending. The counties
will now be in the same order as the table on the previous page.
• Enter the population data values from the earlier table (click in the first cell in the column).
After typing the value, press Enter and you will be moved to the cell below. Continue this
process until all values have been entered.
You cannot add a field while in Edit mode. If you already in Edit mode, you must stop
editing, add the field, and then return to Edit mode to add the values.
• Type the value for the county and press Enter. The table is updated.
• Continue this process until all areas have been added to the appropriate counties.
• When you are done, click Editor then Stop Editing. A window will appear asking if you
want to save your edits. Click Yes.
When dealing with long numbers it is useful to display these numbers with commas separating the
thousands. In addition to ArcMap allowing you to specify your field width, you may also control
the field formatting.
• Right-click the Population field name and select Properties. Press the Numeric button to
the right of Number Format. The Number Format window will open.
• In the Number Format window, check the Show thousands separators buttons box.
5
Figure 7. Formatting the numbers in your field.
• Click OK to close the Number Format window and OK again to close the Field Properties
window. Note the change in your field values.
You may also format the numbers in your fields without having to open the attribute table.
In the Table of Contents, right-click the layer name and select Properties. In the Properties
window, select the Fields tab. In all numeric fields, the Number Format button shown in
Figure 7 will appear in the list of fields.
ArcMap allows you to view descriptive statistics for attribute table fields. Let’s view these
statistics for the Population field.
• Right-click the field name (Population) and select Statistics from the context menu.
A new window appears showing values for the following: count, minimum and maximum values,
sum of all values, the mean, and the standard deviation. The window also displays a histogram
which is a graphical representation of a frequency distribution.
If you select a subset of records (either by performing a query or interactive selection on the
map), the statistics widow will display the descriptive statistics for only the selected records.
Save your project file before moving on to the next part of the exercise.
6
Manual data entry is a fairly easy way to add data to your project. However, it is useful only if you
have a small number of records for which you are entering data. Imagine how time consuming it
would be if you have hundreds of records to add or if you wish to add dozens of fields, or both!
When creating thematic maps, cartographers often use data that is not stored within a shapefile’s
attribute table. Such data may come from public sources (e.g., state and federal agencies), private
sources, or it may be created internally within the organization employing the cartographer.
If this information is stored as a data table (in text format), a spreadsheet, or a database (e.g.,
dBASE, Microsoft Access, or geodatabase formats), you can associate it with your geographic
features and display the data on your map by linking it to the attribute table of an existing map. In
ArcMap, you can establish this kind of link by either joining or relating two tables together.
ArcMap can import certain types of data files. The most commonly imported are files in
dBase format (.dbf) and comma-delimited or tab-delimited ASCII text files (text files that
use commas or tabs to separate values). ArcMap can import certain database formats (e.g.,
dBASE, Access, etc.) as well as Microsoft Excel spreadsheets (up to Excel 2003 format—
ArcMap 9.2 does read Excel 2007 files).
Typically, you'll join a data table to a layer's attribute table. Joins are based on the value of a field
that can be found in both tables. The name of the field does not have to be the same, but the data
type has to be the same. In other words, you join numeric fields to numeric fields, text to text, etc.
Two data files exist in the DataEntry folder, wyoming.xls (an Excel 2003 file) and wyoming2.txt
(a comma-separated text file).
• Add the Excel file project by using the Add Data button. Navigate to wyoming.xls and
double-click the file name. When you do this, a new window opens. The new window
lists all of the tables (worksheets) within the Excel file. In this file, there is only one
worksheet, Housing$.
When importing an Excel spreadsheet, you must double-click the file name in order to view the
list of available worksheets. If you highlight the file name and click Add, you will get an warning
message stating that your selected item could not be added.
7
When the table is added, it appears in the Table of Contents. Note, however, that the tab at the
bottom of the Table of Contents switched from Display to Source.
When the Display tab is selected, the Table of Contents lists only the map layers that are (or can
be) visible in the data or layout view. When the Source tab is selected, the Table of Contents lists
all files that have been added to the document. Also note that when the Source tab is selected, the
layers are organized by folders (e.g., if you add layers from different folders or drives on your
computer) and by databases. The third tab, Selection, allows you to choose which layers you wish
to be able to be selectable.
• To join the imported table to your existing attribute table right-click the County layer,
select Joins and Relates and then click Join.
• Click the first dropdown arrow and click Join attributes from a table.
8
• Click the dropdown arrow and click the field name in the layer that the join will be based
on. In this case, select County.
• Click the dropdown to choose the table to join to the layer (as this you have added only the
Housing$ table, it should appear without having to select it).
• If it does not appear automatically, click the dropdown arrow and select County as the
field in the table to base the join on.
• Click OK.
• The attributes of the table are appended to the layer's attribute table. To check, right-click
the Counties layer and select Open Attribute Table.
Figure 13. The fields from the Excel file are now
added to the end of your attribute table.
Note that the field names that were in the original County layer now are preceded by “WY_county”
(the name of the shapefile) and the fields that were joined from the Housing$ table are preceded
by “Housing$.”
Now you will add the second data table included in your data folder.
• Just as you did with the Excel table, add the wyoming2.txt table.
9
• Open the table. You will see the following fields: COUNTY, FIPS, and SQUARE_MIL.
FIPS is an acronym for Federal Information Processing Standard. The federal government of the
United States has established a unique identifier (code) for every state, county, and place in the
U.S. as well as for countries. The number you see in this field is the county FIPS code—it is
actually a combination of the two-digit state FIPS code (56 for Wyoming) and the three-digit
county identifier (which start at 001 and proceed alphabetically, usually with odd numbers).
One of the things to be careful of when joining files is that in order for a join to be successful the
records in the joined field must be identical.
Note that, while there is a COUNTY field in this table, each county name is followed by “County.”
If you join this table to your County layer based upon this field, you will encounter a problem.
Let’s perform the join to see what happens.
• Using the steps you used with the Housing$ table, join the wyoming2.txt table to your
County layer. Choose “WY_county.COUNTY” as the field in the layer to join on and
select the COUNTY field from the wyoming2.txt file.
• Open the Attribute Table for the Counties layer and scroll all the way to the right until you
see the County, FIPS, and SQUARE_MIL fields.
Notice how “<Null>” appears in every record for these fields. This value is inserted when ArcMap
has no match for that record. In this case, the County names did not match. For example, you had
“Park” in the County layer but “Park County” in the wyoming2.txt table. “Park” and “Park
County” are not identical, so the data values from the wyoming2.txt table were not inserted.
10
Figure 15. If the field values do not match when performing
a join, the data values from the text file will not be joined to
the attribute table.
You can join these files correctly, however. To do this, you have two options. First, you can modify
your text file to remove the word “County” from each county name. Second, you can join the files
using a field other than the county name.
An additional problem when joining tables is when there are multiple records with identical names.
For example, there are many Washington counties in the United States. When attempting to join
tables in a “many to many” situation (many Washington counties in each of the tables), one value
will be assigned to all of the instances of Washington county in your attribute table. This
circumstance occurs because you are joining only on one field, the county name. You are not
joining one both the county and state names. Joining works best when there is a one-to-one
relationship between records.
Let’s do the second of the joining options—joining on a field other than county name. As was
explained earlier, the FIPS code is unique to each county in the United States. Therefore, even if
counties in different states share the same name, e.g., Washington, their FIPS codes will be
different.
First, you will need to remove the join that you just did.
• To do this, right-click the Counties layer, select Joins and Relates, Remove Joins, then
select wyoming2.txt from the list (be careful not to select Remove all joins).
• Next, redo the join, but this time use FIPS from both the layer and the table.
If you have done the join correctly, the data values from the wyoming2.txt table should now appear
in the Attribute Table for the Counties layer.
11
Figure 16. The join performed correctly.
You will now print out your attribute table, but before you do so, you can turn off some of the
fields so that you do not have duplicate fields showing.
• In the Table of Contents, right-click the Counties layer and select Properties.
• Deselect the following (if you have difficulty reading the field names, you can widen the
Name area by dragging the vertical line separating Name and Alias):
o WY_county.FID
o WY_county.Shape
o Housing$.County
o County
o FIPS
• Press OK to register the changes. (Make sure you didn’t deselect WY_county.COUNTY
or WY_county.FIPS.) If you are having difficulty seeing the field names, you can widen
the first column by clicking and dragging the vertical bar separating Name from Alias.
You may also turn off the display of fields from within the attribute table. To do so, right-click the
field name and select “Turn Off Field.”
12
• Open the Counties attribute table. Note how the deselected fields no longer appear. Your
table should have the following fields: WY_county.COUNTY, WY_county.FIPS,
WY_county.Population, Housing$.HousingUnits, and SQUARE_MIL.
Prior to submitting a digital copy of your joined table, you will export the joined attribute table as
a stand-alone table.
• With the attribute table still open, press the Options button. Select Export.
• In the Export Data window, specify a location to save your table (you may click the file
folder button to browse to a location).
Figure 19.
• Change the file name to include your names using the following format:
13