Lab 3: The Vector Data Model

advertisement
Lab 3: The Vector Data Model
Points, Lines, and Polygons. Vector data are represented by points, lines, and polygons
in a Cartesian plane. A point can be used to represent an area such as a city, or an
earthquake epicenter. The line is used to portray linear features such as highways, and
earthquake fault zones. If several lines are joined into a closed figure, a polygon is
created. National boundaries, vegetation, or geologic formations are typically mapped as
polygons. In this lab, you will create point, line, and polygon layers, and learn to
symbolize them in a variety of ways.
The Join Command. The Join command is an important function in GIS. It links an
ordered set of spatial objects, such as points, lines, and polygons, with an ordered set of
aspatial objects, such as tabular data, or flat files. You will learn about ArcView tables,
first exploring the tables for your existing vector layers, and then creating a new table.
Then you will learn how to join these tables.
Visualizations. One of the great advantages of GIS over traditional cartography is the
ease with which a single data set can be queried and visualized from different
perspectives. Varying the ranges of values, or employing alternative category systems
can produce vastly different map products. You will experiment with different
visualizations in this lab.
ArcMap Properties
In the Chapter 2 Lab (Projections and cartography), you learned about the concept of data
layers, and how to add a layer to a view. You also learned how to use the data frame
properties window to change the data frame projection. In this lab you will look at spatial
data sets that represent the basic vector data types and study their differences. Create a
folder for your lab on your computer, zip disk, or wherever you plan to save your data.
Rename the folder (e.g., Lab3). Start ArcMap.
An exciting feature of ArcMap is the ability to change your map properties so that you
can save links to the data layers in your ArcMap project as “full path names” or “relative
path names.” The choice of which to use is important, especially if you plan to distribute
the work that you have been doing.
If you save the links to the data layers as full path names, when you open your ArcMap
project it will look for your data in exactly the same location as it was the last time you
saved the project (i.e., if all of your data layers were located in the d:\data folder, it would
look in the d:\data folder for them when the file is re-opened. If you are now working
from a different drive letter or on a different computer, you will not be able to view any
of your data layers). When ArcMap cannot find a data layer in your project, it will
appear in the Table of Contents with a red exclamation point next to its name.
If this happens, you can fix the problem by updating the link to the data layer source. To
do this, open the layer properties, and under the “Source” tab click on the “Set Data
Source…” button to re-set the data layer source.
If you save the links to the data layers as relative path names, when you open your
ArcMap project it will look for the data in the same relative location as it was before (i.e.,
if your ArcMap project was in the d:\lab3 folder, your data was saved in the d:\lab3\data
folder, and you copy the entire lab3 folder to the e:\ drive of your computer, everything
should work fine – your data is still in the same relative location to your ArcMap file).
If you change the location of your map files relative to your ArcMap file, you will end up
with broken links to your data layers and will need to re-set the layer source, as was
described above.
If you do not have access to a permanent local folder to save your work, it is a good idea
to copy all of the data for your labs into a folder and save it with your map file. When
you do this, it is a good idea to change your map properties so that it saves the links to
your data layers as relative path names. To change this property, click on the File menu
in ArcMap and select “Map Properties.” Set the Data Source Properties so that you save
the path names to your data sources as “Relative Path Names.”
Points
Before you start, save this project as Lab 3 in your lab3 folder. As we did in Lab 2,
rename your data frame (“Layers”) as "Cities.” Naming your data frames and layers will
help you stay organized when your work becomes more complex.
Add the cities.shp layer.
Point data representing cities should now appear in your Data View.
Question: What coordinate system is this data in?
You can change the symbol for the data by opening the layer properties and selecting the
“Symbology” tab.
Click on the box containing the symbol to change its properties (size, color, etc.)
Change the symbol to a red circle of size 2. Click on Okay in the Symbol Selector, and
click on Apply in the Layer Properties window to apply the changes. Note the changes in
your Data View. Now change the symbol size to 16. Note the changes. Now change
the symbol size, color, and angle to one of your choice.
Question: How do you know that these are cities of the United States? According to
material from your text and lecture, would you consider this a map? Why or why
not?
Lines and Polygons
Now add the roads.shp layer from the same directory.
Question: Do the points and lines represent the data with the same level of
abstraction? Discuss in terms of their representation of the two data layers that we
have added so far, and in terms of other types of data that they might represent.
Use one of the data frame zooming tools pictured below to zoom in on an intersection
between a group of cities and highways.
Use the Zoom to Full Extent (the “globe”) icon to zoom back out.
Question: Do one set of features appear to be on top of another? Which one is on
top? Why do you think this is? If you are having problems determining which layer
is on top of the other, it may help to enlarge the size of the symbol representing the
city point data.
Add the states.shp data layer from the same directory as before.
Question: Describe the similarities and differences between points, lines, and
polygons. Which data type do you think is easiest to work with? Why? Which data
type you think is most accurate? Why?
Exploring attribute tables
As is stated in the text, “the power of the GIS is in allowing the attribute and the
geographic or map information to be linked together in a useful way.” (Clarke, p. 42) In
this section we will learn about the structure of the tables containing the attributes for a
spatial data set.
To start, we will explore the attributes associated with the states data layer. Select the
“Identify” tool icon.
Click on a state in the Data View. Experiment with clicking on rivers and cities. In the
Identify Results window, note that you can change the layer(s) that are being identified.
Change the layer to “<All layers>.” Click on an area where there are both cities and
roads located near to eachother.
Question: What happens when you use the identify tool? Is the option to change
the layer(s) being identified useful?
Now right click on the states layer and select “Open Attribute Table.” In the attribute
table, click on the grey square to the left of one of the polygons. This will select it.
Question: When you have selected a record in the states attribute table, what has
changed in the Data View?
Hold down the Control key and click on several more polygons. In the attribute table
options, explore the following menu options:
Also experiment with changing which records are being shown by pressing these buttons:
Joining tabular data to spatial data
We will now look at creating additional tables of aspatial data to link to existing spatial
data sets. Now we will create a new table and join it to the States theme in our map. To
get started, clean up your Data View. Holding down the shift key, select both the cities
and roads layers, right click and select remove. Only the States theme should now
remain.
We will need to use ArcCatalog to create our new data table, so open that module now.
You can actually open it from ArcMap, rather than going through the Start menu as we
have done before. Click on the ArcCatalog icon.
To set up a new table in ArcView, you need to have spent a bit of time thinking through
the characteristics of your table. For instance, what type of data are you planning to add
and how much space you need to reserve to store that data (e.g., if the data is numeric,
how many digits of precision do you need? Do you require decimal level precision?).
All of this information will go into creating the structure for your table in ArcCatalog.
To start, in the Catalog Tree on the left hand side of the ArcCatalog window, locate your
folder with the data for this lab. Select the folder so that you can see the data in the
Contents window on the right hand side of ArcCatalog. In the Contents window, right
click and create a new dBASE table.
A new dBASE table will now appear in your folder. Rename it weather.dbf.
Question: What is in the table when we preview it? Why?
We now need to add some fields to store our data. Right click on the table and select
Properties. The Fields tab is where we edit the structure of our table – deleting fields,
adding fields, and setting properties of fields.
To add a new field, type the name of the new field in an empty row in the Field Name
column. Name your first field “States.” Set its data type to “text.” We should now edit
the length of the field (the maximum number of characters that can be stored in any entry
in the field) – for this table, set it to 20.
Note: It is very important that you define fields properly. In ArcView there are
seven field types. Four of them are numeric types of different precision (short
integer, long integer, float, and double). The remaining types are Text, Date, and
BLOB (Binary Large OBject – a binary data type that stores large image, text, or
geometry data as attributes). We will use only Text type data in this lab. Text data is
sometimes referred to as String data.
Question: Why do you think the Field Definition requires that you differentiate
between text and numeric data types? Why do you need to specify the field width?
We will also add a Weather field of type Text and length 10.
Now that you have defined the structure of your table, we can add some data to it. Where
editing the structure of a table is done in ArcCatalog, editing the contents of a table is
done in ArcMap. Add your table to your ArcMap project.
Note that when you add the table to ArcMap you can only see is in the Table of Contents
when you have the Source tab selected in the Table of Contents. This is because the table
by itself is not spatial and is therefore not shown in the Data View.
To edit the table, right click on the table icon and select “Open.” Now turn on the Editor
toolbar by clicking on Tools in the main menu bar and selecting “Editor Toolbar.” Click
on the Editor button on the toolbar and “Start Editing.”
Click in the first State record and type in the name of a state. Then type in a general
weather description in the Weather field for each record (remember that we set the length
of the field to 10 characters!). Create weather records for ten more states.
Now pull down the Editor menu on the toolbar, and select Stop Editing. When you are
prompted to save your edits, select Yes. Alternatively you can save edits while you are
working by pulling down the Editor menu and selecting Save Edits. It is a good idea to
do this periodically, just in case the computer crashes or the software freezes.
Now we will join our new weather.dbf table to the table for States.shp. The names of the
states will be used to relate the two fields to each other – because of this, it is very
important that you have spelled the names of the states correctly and capitalized
appropriately! It is very important to understand the concept of source and destination
tables. States for which you have not supplied a value in the weather field will end up
with a blank entry in the record. The data then is moving from the source table:
Weather.dbf, to the destination table: Attributes of States.shp. Be certain that you have
stopped editing your weather table.
Right click on the States layer, select “Joins and relates.” Select Joins. In the window
that opens, select “State_Name” as the field on which the join will be based (this is the
field in your “Destination” attribute table, the attributes of the States layer). Choose
Weather as the table to join to the States layer. Select the “States” field as the field on
which the join will be based in the Weather table.
When you have everything set up, click OK.
Open the attribute table for the States layer (right click and select “Open Attribute
Table.”) Examine the table.
Question: What has changed in the table?
Question: How is the original attribute data from the States layer distinguished
from the Weather data that you joined?
Question: What would happen if you tried to join the attributes from the States
layer to the Weather data (rather than joining the Weather data to the States data
as you just did)?
Conclusion
In this lab we have explored the three basic vector data types: points, lines, and polygons.
In addition we have explored the structure of the relational database. We have seen that
spatial data in the vector format consists of spatial data objects linked to flat files or
tables consisting of aspatial data objects. We have seen that new data tables can be
written and related to existing data tables.
Download