USING ARCVIEW

IPM CRSP

VIRGINIA TECH - CARDI JAMAICA

INFORMATION SYSTEMS FOR COLLABORATIVE RESEARCH

GIS WORKSHOP

August 18 - 20, 1998

Larry Grossman

Department of Geography

Virginia Tech


NOTE: The materials on these pages--both in printed form and on the World Wide Web--are to be used only in association with the Virginia Tech IPM CRSP. Reproduction or use of these pages, in part or in full, for commercial purposes is strictly prohibited. Those wishing to reproduce or use these pages for non-profit, educational purposes should contact the author at LGROSSMN@VT.EDU for permission.


Acknowledgment: All coverages and part of the data in these GIS lessons are supplied by Glynis Ford of the Rural Physical Planning Division (RPPD), Ministry of Agriculture, Jamaica.

Step 9: Spatial Analysis I: Querying the Data

Our first concern has been with displaying data on our map. We now want to analyze spatial patterns on our maps.

We are going to "Query" our data, that is, let you select features in a view and records in a table that meet the criteria you specify in an equation, which is in the form of a logical statement. Querying is used to examine relationships between variables and finding locations that meet certain criteria. This will demonstrate how GIS incorporates several themes in analyses to help solve real world problems.

First, only have the themes bpkprcl.shp and Jarivers displayed on our map. Display the distribution of crop types in bpkprcl.shp; the theme "Crop1" has the data we need. Be sure to select the appropriate "Legend Type" before you select "Crop1."

We have three main crops in the area; bananas, callaloo, and sweet potato. Our map should look like this.

We are concerned with explaining the distribution of pests in sweet potatoes and callaloo--weevils and "leps" (Lepidoptera)--respectively.

We hypothesize that the distribution of weevils in sweet potato gardens, which are concentrated in the eastern half of the village, is affected by irrigation use, because soil moisture tends to inhibit weevil infestations.

Now change the map of bpkprcl.shp to show the distribution of weevils (data are in the field "SP weevil count"). You need to change the Legend Type in the Legend Editor dialog box to "Graduated Color" because the data are ratio level. (Note: I used the Cyan monochromatic color scheme here.) Change the theme name in the Table of Contents from "bpkprcl.shp" to "SP weevil count." Remember that you need to open the Theme Properties dialog box to change the theme name.

Be sure that the theme "SP weevil count" is active because this is the theme that we will query.

Then we need to click on the Theme Properties THEME PROPERTIES button at the top of the screen below the menu to bring up the Theme Properties dialog box.

NOTE: If anything appears in the large box in the middle of the dialog box below the Clear button on the right, you need to remove it first by clicking on the Clear button.

Now click on the Query Builder button in the dialog box that has a hammer and "?" in it QUERY BUILDER, which brings up the Query Builder dialog box.

What does the Query Builder do? It allows us to create an equation to examine a particular variable (or field), such as "SP weevil count," showing on the map only those tracts that meet our criteria. Any tracts that do not meet our criteria will not be displayed on the map. We will create an equation to ask the Query Builder to display only those tracts that have irrigation but not to display the other tracts. Because we are already displaying information on weevil counts, we can then examine those still displayed after using the Query Builder to see what their counts are.

Let us examine the "Query Builder" dialog box. In the upper left is a list of the different "Fields" or variables for our active theme that we can select. In the center are numerous buttons with mathematical operators, such as "less than," "equal to," "greater than or equal to," etc. In the upper right, all the "Values" for a selected "field" (variable) will be listed. In the bottom left of the dialog box is the "equation box" where we will create an equation to specify what we want the map to display. Right now only a left and right parenthesis sign are there.

It is crucial that you adhere to the following steps precisely or you will create an equation with an invalid syntax. If you create an invalid expression, ArcView will not be able to perform the desired task.

Basically, a query takes the format in the following example:

( [area] = 1500 ).

That is, the entire query is enclosed in parentheses, the field name appears first, always enclosed in square brackets, followed by a mathematical operator, and then the number or category (such as yes or no, crop type, 15200, etc.) that you specify. In this case, you are telling ArcView to display only those areas that have values equal to 1500. (Note: queries can, in fact, be much longer and much more complex.)

First, from the list of "Fields" select "[Irrigation]". (Sometimes you have to scroll down to find the field.) This field contains the data on whether the tract is irrigated.

Double click on [Irrigation] and it will appear in the "equation box" in between the left and right parenthesis signs. Note also that in the "Values" list on the right of the dialog box, the values ("y" for yes and "n" for no) for [Irrigation] have just appeared. (Note: when the value "-99" appears, it means that no data are available for an item)

Then click on the "equal to" button and the specified relationship will also appear in the equation box to the right of [Irrigation].

Now we have to add in the value or category that we want for Irrigation into the equation box. Thus, in the list below the category "Values" in the upper right of the Query Builder dialog box double-click on "y" (for yes) which will now appear in the equation box.

(Note: you can also type in what you want to specify directly into the equation box instead of double-clicking, but we will not do that here.) Make sure that your equation is exactly the same as this one. Now click on the OK button and the query builder equation that we created will appear in the "Theme Properties" dialog box.

If your equation is correct, click on the OK button. (If your equation is incorrect, click on the Clear button to erase your equation and start over by then clicking on the "Query Builder" button again and going back to the Query Builder dialog box to create a new equation.)

Now our map will be redrawn so that only tracts meeting our criterion of having irrigation will be displayed; the other tracts with no irrigation will not be displayed. Because we previously classified tracts according to weevil counts, we can visually examine those remaining to answer our spatial questions.

Go ahead and change our query to display only those tracts without irrigation. You need to bring up the "Theme Properties" dialog box again and click on the "Query Builder" button to bring up the "Query Builder" dialog box. Here we see the equation that we had created. We can change it easily by highlighting the letter "y", then erasing it and substituting the letter "n" (for no) so that the dialog box looks like this:

Click on the OK button which brings back the Theme Properties dialog box with our new equation. Click on the OK button to reveal our map displaying tracts with no irrigation.

After looking at both maps, what is your answer to our question concerning the influence of irrigation on weevil counts?

Now we will create a more complex query. Note that our map is displaying areas that have all three crops, but only the area with sweet potatoes is really relevant. To portray only those tracts with sweet potatoes, open up the Theme Properties dialog box and click on the Query Builder button to bring up the Query Builder dialog box, where we see our equation. We want to add to the formula to show only those areas with sweet potatoes. To do so, double-click on the "and" button located in the buttons in the upper middle of the dialog box. Note that the word "and" now appears in our equation and to the right of it is a new parenthesis in which we place our additional criterion of sweet potatoes.

Scroll down the list of Fields on the upper left of the dialog box until you find "Crop1" and double-click on it.

Note that the field "Crop1" also appears in our equation below. Now click on the "equal to" button" and then double-click on "sweet potat" in the Values list, which add these criteria to our equation.

Click on the OK button. Now we see our new, more complex equation in the Theme Properties dialog box.

.

Click on the OK button to reveal the changes on our map, which now only displays tracts with no irrigation and sweet potatoes.

.

While the results seem fairly clear in this case, your queries will not always produce such results. What if there were one or two tracts that appeared at variance from what we observed in relation to the other tracts? Remember that our variable is "irrigation" and that we know nothing about how frequently the tract is irrigated or how much water is available for irrigation at a particular plot. To find out more about the characteristics of particular plots that seem at variance, simply use the "Identify" tool to examine the characteristics of the particular plots of interest.

We could make our queries even more complex, showing only those tracts with properties controlled by male- or female-headed households or in which only certain IPM strategies or pesticides are used.

A key dimension of GIS is to examine spatial relations, that is, where features on our maps are located in relation to other features. For example, if there were no irrigated fields, we could examine queried data in relation to their proximity to rivers (tracts next to rivers may have higher soil moisture contents), which are also displayed on our map. Thus, if we were querying weevil counts in relation to different pesticides used and found patterns that at first appeared inconsistent, we may find the answer to unexpected variability in our data by seeing where such variation occurs in relation to the location of rivers.

We want to build a different query, so we must first remove the query equation so that all our tracts reappear on the map showing the distribution of weevil counts. To remove the changes that we made to the map so that the shadings for weevil counts for all tracts reappear, simply bring up the "Theme Properties" dialog box again, click on the "Clear" button to delete the equation that we created, and then click on the OK button. Our original map will be redrawn.

Now change the map so that it displays leps counts (data are in the field "lep count") and change the name of the theme to "Leps count."

Now go ahead and build a query expression to examine the relation of irrigation to the field "lep count" for callaloo plots only. Do we have the same relation as we found with weevil counts? What else would contribute to the spatial pattern of lep counts? Let us assume that the lep population is positively influenced by very slow winds and high humidity; which crop of the three in our area would contribute to such phenomena?

Also, if you have time, examine what variables influence the distribution of the number of cattle held in the Bushy Park tracts on our map (field is "Num_cattle"). Be sure to display the entire map first. The influence(s) could be environmental and/or social.

These examples are relatively simple. Those who use GIS professionally have to examine much more complex problems, but the basic ideas are the same as those used here.

[Return to beginning]

[GO TO STEP 10]