TEACHING GEOG 385.02/GTECH 785.02 
GIS APPLICATIONS IN SOCIAL GEOGRAPHY
Back to MP home page

GIS SG course homepage
Back to GIS SG schedule
GIS links and resources
Class Project


Competency Exercise 10.

ArcView exercise 1. Display, Database Query, and Map Algebra in ArcView.

Start:

4/28

Due:

5/5

Data:

Download from the data links page. 

 

 

Turn In:

Hand in names of municipalities with the largest and the smallest area in sq.miles.



1. DISPLAY

The data consists of the following layers of information for one area of New Jersey:

Landuse (LANDUSE)
Political units/municipalities (MUNICIP)
Streams (STREAMS)
Lakes (LAKES)
Roads (ROADS)
Factory locations (FACTORIES)
Public school locations (PUBLIC)

 Begin by launching the ArcView program and creating a new view within the default project called UNTITLED:

Launch ArcView by clicking Start Programs ESRI ArcView 3.1 ArcView 3.1

Maximize the ArcView window by clicking on the middle of the three buttons in the upper right hand corner of the ArcView program window.

When ArcView opens it displays an empty project window called UNTITLED. Projects can have several items within them (views, tables, charts, layouts, or scripts), but we are here only interested to create a view using the data provided. To create a new view make sure that the word "views" is highlighted and click on NEW.

Displaying Themes:

You now have a new (empty) view open called VIEW1. Within that view you can display several themes. Do the following to explore the data (themes) provided:

When View1 is open, note how the main menu and set of icons changes giving you more options relevant to views. Go to VIEW in the main menu and select ADD THEME. (Or find the Add Theme icon and click it.)

Locate the data provided. Select the shape file called LANDUSE.SHP. (If you don't see this listed, make sure you did the previous step correctly and that Data Source type is Feature.) Click OK.

The landuse file is now part of the view but is not yet visible. Click in the little box to the left of the word LANDUSE in the VIEW to display the theme. A check mark will appear which means that it is visible.

You can make the view larger by using your cursor to drag the edge or corner of the view box. Position the cursor over the edge and when it changes to a different arrow, drag the box to the desired position.

Repeat the above procedure to add these other map layers: FACTORIES, STREAMS, ROADS, LAKES, PUBLIC, and MUNICIP. You can select them all at the same time by holding down the Shift key while clicking the file names. Don't select LANDUSE again.

View each theme one by one by making invisible all other themes (click off the check mark to the left of theme names that you do not want to see and click the check mark on for just one theme).

Note that "checked" themes will be displayed in the order they are listed. So, if you display (check) 2 themes at one time, the one closer to the top of the list will display on top of the theme that is lower on the list.

You can change the order of the themes by clicking on the name of a theme and dragging it to another position in the list.  Try placing the LAKES at the top of the view list and then displaying LAKES and LANDUSE at the same time. Also, practice zooming in and out using the magnifying glass icons and other options under the VIEW menu item. The hand icon allows you to pan. You can use the plus magnifying glass to draw a box around a region to zoom into. To return to the original view, choose Full Extent under the View menu, or click on the Zoom to Full Extent icon.

Legends:

The theme LANDUSE is displayed using only one color even though it is made up of several different landuse categories. It would be better to create a legend that displays the names of each class/category within this landuse layer and then assign a unique color to each. To do this you will use the LEGEND EDITOR.

Double click on the word LANDUSE in the MAP VIEW and the Legend Editor dialog box appears (you could also look under THEME in the main menu and choose Edit Legend provided that the LANDUSE theme is "active." To make a theme active simply click on the name of the theme).

Click the down arrow to see the options for LEGEND TYPE. There are five options: single symbol simply allows for one symbol for the entire theme, graduated color would be used for an attribute that is quantitative data (similar in concept to Idrisi 256), unique value would be used for an attribute that is categorical data (similar in concept to Qual256 or another qualitative palette), dot would be used to put a dot or circular symbol in each feature, and chart can be used to place small charts in each feature showing several attributes.

Change LEGEND TYPE to Unique Value.

Now click on the VALUES FIELD down arrow. Note that there are several fields (attributes) you could choose to display in the legend. These are attributes stored in a separate table that are linked to each landuse polygon (feature). The field with the names of each landuse category/class is called CLASS. Change the VALUES FIELD (the field with the values that you wish to display) to CLASS for this legend.

Change the COLOR SCHEME to some palette of your choice. The scheme called Bountiful Harvest works fine. All of the choices are qualitative palettes (ArcView gives these choices because you set the LEGEND TYPE to Unique Value). [Optional Exploration: To set particular colors, double click on a color box in the symbol column of Legend Editor. Click the paintbrush icon and set the color you want. Then press Apply.]

Click on APPLY.

Close Legend Editor (click on the x in the upper right corner of the editor).

Like the landuse theme, you can also select any attribute from the MUNICIP theme for its legend (both legend labels and color) using LEGEND EDITOR. One field (attribute) linked to MUNICIP is called POPDEN90_S and represents population density in 1990 for each municipality (people per sq. mile). Edit the legend for MUNICIP such that it displays population density with an appropriate color scheme (palette).
 

Open Legend Editor for the MUNICIP theme by either making the theme active, then choosing Edit Legend from the Theme menu, or simply by double clicking on the MUNICIP theme name.

Choose Graduated Color from the drop-down list of legend types.

Choose POPDEN90_S from the drop down list of values fields.

Choose the Color Ramp you prefer.

Click Apply.

2. DATABASE QUERY BY LOCATION

Query by single features:

With the same themes from section 1 in our view, we can use the cursor to query by a single location or feature (similar to Idrisi where we used the cursor to get the Z value). Lets find the name (one of many attributes available) of the large lake at the top of the study area.

Display the theme LAKES on its own (i.e., make all the other themes invisible).

Make sure the LAKES theme is "active." It should appear raised in the list of themes. Once active, the remaining operations will be relevant to the theme LAKES only.

Initialize the IDENTIFY option by clicking the first icon from the left on the second tier of icons (it looks like the international symbol for information).

Put the cursor (that is now a cross hair) over the large lake at the top of the map and click the left mouse button.

The IDENTIFY RESULTS dialog box which appears shows the name of the lake (Lake Tappan) as well as all of the other associated attributes for that one feature. These are all the values from the fields (columns) in the database for the record (row) that represents Tappan Lake.

Now make other themes active and use the IDENTIFY tool to explore the attributes of different features. Note that each feature queried is added to the list in the Identify Results box, no matter what theme they are from. You can clear this list at any time by clicking on the Clear buttons.

Query by multiple features:

Make visible only the LAKES theme and make the LAKES theme active.

Open the attribute table (also referred to as the database) associated with LAKES by selecting TABLE in the THEME Menu or by clicking on the Open Theme Table icon. Note that this action will open the database table of the active theme. (If you maximized the View earlier, the table will now be maximized. Click on the tile button to make both the View and Table windows visible at the same time.)

Scroll through the table to see all of the attributes (arranged in columns called fields) for each feature (arranged in rows called records).

Arrange the VIEW window and the TABLE window side by side. Both can be resized by dragging the edges. Put the VIEW in focus by clicking on the banner that says VIEW1.

Initialize the SELECT FEATURE option by clicking the fourth button from the left in the second tier of icons (looks like a box).

Move the mouse pointer into the map and select features by either clicking on individual features or drawing a box to select several features at once.

Notice that selected features turn yellow and that the records in the database associated with the selected features also turn yellow. To group all the table records for the selected features together at the top of the table, make the table active then use the Promote command from the Table menu or click on the Promote icon.

To clear the selected features, if the Table is active, use the Edit/Select None command or the Select None icon. If the View is active, do the same by choosing the Theme/Clear Selected Features menu item or the Clear Selected Features icon (which looks the same as the Select None icon when the Table is active).

With the Table active, click on a record. Note that the record is highlighted and the feature is also highlighted in the View. To select multiple records in the table, hold down the shift key.

Close the lakes table.
 

3. QUERY BY SINGLE AND MULTIPLE ATTRIBUTE

Query by Single Attribute:

Using the municipality data we displayed above, we will identify all municipalities (features) that have high populations (a particular attribute) in 1990. We will build a query that will select from the table all records where the value in the field representing population in 1990 is greater than 35,000. These records are associated with individual municipalities on our map.

Make visible just the MUNICIP theme and make that theme active.

Open the database table associated with the MUNICIP layer by choosing TABLE in the Theme Menu.

With the database table in focus, open the QUERY BUILDER by choosing Query in the TABLE Menu or use the Query Builder icon from the toolbar (the hammer).

You will now write an equation that will query (also called filtering) the database to select only those records of interest (i.e. where the population in 1990 is 35000).

The equation to enter is: [Pop90] 35000. Pop90 is the field/attribute containing values representing population in 1990 for each municipality. Field names have to be spelled exactly the same way they are written and should be enclosed by square brackets. Rather than typing the field name, it is easier to double click on the name [Pop90] in the list of fields (attributes). This will ensure correct spelling and will automatically add the brackets. Next select the ‘ ’ sign, and then type in the number 35000. You will see a list of attributes in the Query Builder dialog. In this case, our particular attribute is not listed. We will often need to type in attributes for quantitative variables (like population), but will be able to choose attributes from the list for qualitative variables (like landuse class).

Finally, click on NEW SET to run the query/filter. The NEW SET command finds all those records that meet the condition you've entered, regardless of whether any records are currently selected.

Close the Query Builder box.

Note that the selected features where population is greater than 35,000 turn yellow in the view. Also, the associated records in the database table turn yellow.

Move the selected features to the top of the database by choosing PROMOTE in the TABLE Menu.

Query by Multiple Attribute:

Perform a multiple attribute query identifying municipalities that are both small in area (less than 2 square miles.) AND have low population densities (less than 1000 persons per square mile).

First deselect the currently selected features in the database by choosing SELECT NONE under the EDIT menu.

With both the MUNICIP theme and table showing, open Query Builder.

Enter the following operation into the Query Builder: ([Area_sq_mi] < 2) and ([Popden90_s] < 1000) and then choose NEW SET. (Note that there are several Area fields. Use the one shown above. Also be very careful of the placement of the parentheses. If you get a syntax error, it is probably because the parentheses are wrong. Edit the equation and click New Set again.)

This time you want to query for municipalities that either have a population density less than 2500 persons/square mile in 1990 OR they are less than 2 square miles in area. However, the selected municipalities must be in Hudson County.

Open Query Builder

Enter the following operation into the Query Builder:
[Area_sq_mi] < 2

Select NEW SET. This finds all the records in the database that have area less than 2 square miles. If you look at the status bar just below the icons, you will note that 22 of 63 records were selected using this criterion.

Clear the equation from Query Builder by highlighting it and pressing Delete. (Or close and reopen Query Builder.)

Now enter the following operation into the Query Builder:
[Popden90_s] < 2500

This time click ADD TO SET. This option provides the logical OR. We want those records that have area less than 2 square miles OR population densities in 1990 of 2500 people per square mile or less. Some municipalities may meet both conditions while many will meet only one or the other. Given our criteria, any of these will do. We want to add the low density municipalities to the current selection of small municipalities. (If we chose New Set here, we would lose all records that met the first criterion but not the second.)

Note in the status bar that there are now 39 of 63 records selected. You can promote the selected records in the table and browse through them to verify that at least one of the criteria is met for each selected record.

The final criterion was that the municipality must be in Hudson County. In logical terms, we could say that we are looking for those municipalities that are small OR sparsely-populated AND are in Hudson County.

Clear the equation that is in Query Builder and enter the following:
[County] = "Hudson"
The quotes are required around Hudson because it is a text field. If you choose Hudson from the attribute list, the quotes will automatically be added.

This time we want to SELECT FROM SET. This will apply the new criterion only to those records that are already selected. There are many municipalities in Hudson County -- we want only those that meet one or both of the other criteria. This is the logical AND. The status bar should show that 4 of 63 records are selected.
 

Rather than running three separate queries, we can construct one query to solve the previous problem.

First we will remove the current filter. Choose either the Select None or the Clear Selected Features function (depending on whether you have the Table or View active).

Delete the equation that is in Query Builder, then enter the following operation, again being very careful with the syntax:
([Area.sq.mi] < 2) or ([Popden90_s] < 2500) and ([County] = "Hudson").

Then select NEW SET.
 

4. MAP ALGEBRA

Create a new (empty) field that can hold numerical data and fill this field with the results of calculations from other fields.

With the MUNICIP database table in focus, choose to START EDITING from the TABLE Menu.

Add a new empty field to the database by selecting ADD FIELD from the EDIT Menu.

Write in the new field name POPCHANGE and keep all the defaults (NUMBER as type, and a width of 16, decimal places 0.

Click OK. The new field appears in the database and is in focus.

Now choose CALCULATE from the FIELD Menu to open the FIELD CALCULATOR. This dialog lets you build equations similar to QUERY BUILDER.

In the FIELD CALCULATOR, the first part of the equation is already there: "POPCHANGE =". You need to use the mouse to select the ‘fields’ and the ‘requests’ to create the equation: [Pop90] - [Pop80]. Population change is the difference between population in 1990 and 1980.

When finished, click OK. Notice that negative numbers suggest a population decrease.

Now that there is a new attribute in your database representing change in population, query the database to find municipalities that experienced large population increases (population growth greater than 2000).

5. SORTING and FIELD STATISTICS

Example: arrange the records according to size in square miles.

Remove the current filter using the Select None or Clear Selected Features functions.

Click on the Area_sq_mi field heading in the table. The field name should become highlighted.

From the Field menu, choose Sort Ascending or Sort Descending. Icons are also available for these.

To generate statistics for a field, highlight the field name and choose Statistics from the Field menu.

Top of page