Working with Grid Data


Scope
Working with grid coverages as the basis for further analysis in a GIS environment.

Software
ESRI ArcView GIS v3.2, SunOS
Spatial Analyst Extension

Data Inputs
Region of Interest Carp Village, Ontario, Canada
Projection UTM, zone 18, NAD 27, units meters
Image Data carp1_obm.tif

Method

Table 1: CarpVill grid table modification list
Value Material
3 Bedrock
5Eroded channels
6 Loam
9 Sandy loams
11 Residential
14 Clay loams

Output Grid coverage with edited table. Table 1 illustrates the contents of the grid's edited table:

Table 2 - CarpVill grid coverage table (after edits)
Value Count Material
0 5099 Unclassified
1 18161 Unclassified
2 2439 Unclassified
3 76067 Bedrock
4 1986 Unclassified
5 12146 Eroded channels
6 9938 Loam
7 51 Unclassified
8 18 Unclassified
9 10320 Sandy loams
10 138 Unclassified
11 9114 Residential
12 11439 Unclassified
13 2776 Unclassified
14 90308 Clay loams

Analysis

1./ Determining Grid Size

Methods for determining the size of the grid in ArcView (in number of cells):
a. / ArcView API:


Figure 1: Theme | Properties output
[Cell Size Properties Within ArcView API]

b. / Mathematical Equation
Fundamentally, the following equations will render the same results as the ArcView API:

numrows = (right - left)   / cellsize
numcols = (top   - bottom) / cellsize
Where the variable names map to the GUI above.

c. / Avenue API
Additionally, the Avenue API can be used to gather this information. The following example gives similar results as previous:

myHdr = "QueryGrid"
if (av.GetProject.FindDoc("Carp Village") = nil) then
  MsgBox.Error("Unable to find Carp Village", myHdr)
  exit
end
strFileName = "carpvill"
gridSrcName = Grid.MakeSrcName(strFileName)
if(gridSrcName = nil) then
  MsgBox.Error("Unable to access " + strFileName, myHdr)
  exit
end

myGrid = Grid.Make(gridSrcName)

myRowsCols = List.Make
myRowsCols = myGrid.GetNumRowsAndCols
myCellSize = myGrid.GetCellSize

MsgBox.Info(strFileName + ": " +
            myRowsCols.Get(0).AsString + " rows, " +
            myRowsCols.Get(1).AsString + " columns" +
            "Cell Size: " + myCellSize.AsString , myHdr)

2. / Map Area Query
To assess how much of the map area is not associated with the records entered in table 1, an Avenue script was written to return the following values:

Table 3: Area Query Results
Cell Count 42107
True area (m2) 4210700
True area (hectares) 421.07
Percentage of total area (%) 16.8428

The following code was appended to the previous Avenue code example:

myStr = "Attributes of CarpVill"

theTable = av.GetProject.FindDoc(myStr)

if (theTable = nil) then
  MsgBox.Info("Unable to access " + myStr.AsStr, myHdr)
  exit
end

theVTab   = theTable.GetVtab
theBitMap = theVTab.GetSelection

myQueryStr = "( [Material] = """" )"

theVTab.Query(myQueryStr, theBitMap, #VTAB_SELTYPE_NEW)
theVTab.UpdateSelection
theField = theVTab.FindField("Count")

totalCells = 0

for each thingy in theVTab.GetSelection
  i = theVTab.ReturnValue(theField, thingy)
  totalCells = totalCells + i
end

areaSqMeters    = totalCells * (myCellSize^2)
areaSqMeters.SetFormat("dddddddd")
' we know 1 square meter is 0.0001 hectares
areaHectares  = areaSqMeters * 0.0001
totalArea     = myRowsCols.Get(0) * myRowsCols.Get(1)
percTotalArea = (totalCells / totalArea) * 100

MsgBox.Info("Cell count:     " + totalCells.AsString + NL +
            "Area (m2):      " + areaSqMeters.AsString + NL +
            "Area (hectares) " + areaHectares.AsString + NL +
            "% of total area " + percTotalArea.AsString, myHdr)

The script's output was compared to a spatial query and field statistics functions through the ArcView API.

3. / Grid Clipping

A graphical rectangle was selected to create a polygon, then editing the polygon size and position properties (lower-left origin of 418000,5021000). The ESRI-supplied grextrct.ave Avenue code was then compiled and run to create a clipped-grid theme of Carp Village. The Carp Map at the conclusion of this report illustrates this clipped them generated by an ArcView layout.

4. / Area Analysis on Clipped Themes

The cells classified as residential are derived from old maps; there is evidence that new roads have been added to the map mainly in the central portion where clay loam cell values lie.

Assuming the present-day residential area includes the old residential area (as per this clipped theme), in addition to the clay loam, plus all unclassified land features, the size of the newly defined residential area is:

Table 4: Area Query Results
Cell Count 22941
True area (m2) 2294100
True area (hectares) 229.41
Percentage of total area (%) 57.3525

These figures were derived in the same manner as Section 2, with some modifications to the script (pointing to the clipped theme and table). Validating this procedure was Spatial Analyst's Analysis | Reclassify function, in which cell values 0,1,2,4,7,8,10-14 were reclassified into a unique value of 32, returning matching results. A query and field statistics function was performed similarly to Section 2 for verifications.

Figure 2 Reclassification Output [Reclassification output of clipped region of Carp]
October 2000
Geospatial Analysis Home