Copyright: Copyright (c) 1990-1996 ESRI, Inc.


Error message displayed when a topic is not found
Topic not available

Sorry, the topic you chose to display is not available in ArcView's help system.

To see ArcView's Help Contents, Index, and Find tabs, please click the Help Topics button.


TabulateAreaDialog

 This class provides a dialog for specifying parameters for the aGrid.TabulateArea request.

This class and it's requests are only available with the Spatial Analyst.

Inherits From

ModalDialog

Class Requests

TabulateAreaDialog

Show ( aView ) :  List

__________

See also

View
Grid


Show (TabulateAreaDialog)
Show
Example

Shows the Tabulate Areas dialog.

All GThemes, with a VTab, and FThemes in aView are available in the dropdown lists for Row Theme and Column Theme in the dialog.

Returns a List of the following:

      0: colTheme (Theme)
      1: colField (Field)
      2: rowTheme (Theme)
      3: rowField (Field)

This request is only available with the Spatial Analyst.

Syntax

TabulateAreaDialog.Show (aView)

Returns

List


DensitySurfaceDialog

 This class provides a dialog for specifying parameters for the Grid.MakeDensitySurface or anFTab.CalculateDensity requests.

This class and it's requests are only available with the Spatial Analyst.

Inherits From

ModalDialog

Class Requests

DensitySurfaceDialog

Show ( aPointTheme ) :  List

__________

See also

Grid


Show (DensitySurfaceDialog)
Show
Example

Shows the Density Surface dialog. By default, the radius value is initially set to the smaller distance of the width and height of the extent of the input point theme (or the extent of the selection) divided by 30.

aPointTheme should be a point or multi-point FTheme.

Returns a List of 4 elements:

     0: population Field (Field)
     1: density type (GridDensTypeEnum)
     2: radius (Number)
     3: area conversion factor (Number)

This request is only available with the Spatial Analyst.

Syntax

DensitySurfaceDialog.Show (aPointTheme)

Returns

List


FocalStatisticsDialog

 This class provides a dialog for specifying parameters for the aGrid.FocalStats and Grid.MakeFromPointStats requests. This class and it's requests are only available with the Spatial Analyst.

Inherits From

ModalDialog

Class Requests

FocalStatisticsDialog

Show ( aTheme, aGridStaTypeEnum, aCellSize ) :  List

__________

See also

Grid
NbrHood


Show (FocalStatisticsDialog)
Show
Example

 Shows the Neighborhood Statistics dialog.

aTheme can be either a GTheme, or a point or multi-point FTheme with at least one numeric Field.

aGridStaTypeEnum specifies the type of statistic that dialog shows when it first comes up.

aCellSize specifies the cell size for the output Grid created with the objects on the returned List with the aGrid.FocalStats, Grid.MakeFromPointStats, or anFTab.FocalStats requests. It is used to convert between map and cell units when specifying parameters for the neighborhood with the dialog.

Returns a List of 3 elements:

     0: type of statistic (GridStaTypeEnum)
     1: a neighborhood (NbrHood)
     2: a Field (Field)

The Field is only returned when aTheme is a point or multi-point FTheme.

This request is only available with the Spatial Analyst.

Syntax

FocalStatisticsDialog.Show (aTheme, aGridStaTypeEnum, aCellSize)

Returns

List


GLegExt

 The GLegExt class supports the addition of GTheme specific information to the Legend class.

GLegExt can be added to a Legend using the aLegend.SetExtension request by passing in an instance of a GLegExt. A GLegExt can be retrieved from aLegend using the aLegend.GetExtension request with GLegExt as the class parameter. To remove a GLegExt from aLegend, use the aLegend.RemoveExtension request with GLegExt as the class parameter.

GLegExt objects support the storage of the advanced Legend options available for GTheme Legends in the Legend Editor.

These options allow the user to specify a second GTheme whose cell values are used to spatially modulate the brightness of the colors of each cell in the GTheme to which the Legend is applied.

By specifying a shaded relief GTheme (produced by the aGrid.HillShade request on any surface Grid) as the brightness GTheme in the Legend for a GTheme representing, for example, a soils or landuse layer, the user can create a map display in which the brightness of the basic soil or landuse colors for each polygonal area are modulated by the relief information within the area.

Inherits From

LegendExtension

Instance Requests

Getting and Setting GLegExt Properties

GetBase  :  Obj

GetBrightnessGrid  :  Grid

GetBrightnessThemeName  :  String

GetBrightnessThemeView  :  View

GetMaxBrightness  :  Number

GetMinBrightness  :  Number

GetOffSet  :  Number

GetZScale  :  Number

OverrideAdvancedDialog  :  Boolean

QueryBrightnessRange ( minBrightness, maxBrightness )

SetBase ( aObj )

SetBrightnessRange ( minBrightness, maxBrightness )

SetBrightnessThemeName ( aGThemeName )

SetBrightnessThemeView ( aView )

SetOffSet ( aDoublePtr )

SetZScale ( aDoublePtr )

ShowAdvancedDialog ( theOwningTheme )

__________

See also

Legend
GTheme
Grid


GetBase (GLegExt)
GetBase

 Gets the surface base gtheme

Syntax

aGLegExt.GetBase

Returns

Obj


GetBrightnessGrid (GLegExt)
GetBrightnessGrid

Gets the brightness Grid for aGLegExt.

Syntax

aGLegExt.GetBrightnessGrid

Returns

Grid


GetBrightnessThemeName (GLegExt)
GetBrightnessThemeName

Gets the brightness GTheme name for aGLegExt.

Syntax

aGLegExt.GetBrightnessThemeName

Returns

String


GetBrightnessThemeView (GLegExt)
GetBrightnessThemeView

 Gets the View containing the brightness GTheme.

Syntax

aGLegExt.GetBrightnessThemeView

Returns

View


GetMaxBrightness (GLegExt)
GetMaxBrightness

Gets the maximum brightness value for aGLegExt.

Syntax

aGLegExt.GetMaxBrightness

Returns

Number


GetMinBrightness (GLegExt)
GetMinBrightness

Gets the minimum brightness value for aGLegExt.

Syntax

aGLegExt.GetMinBrightness

Returns

Number


GetOffSet (GLegExt)
GetOffSet

 Gets the z offset for the surface base gtheme

Syntax

aGLegExt.GetOffSet

Returns

Number


GetZScale (GLegExt)
GetZScale

 Gets the z factor for the surface base gtheme

Syntax

aGLegExt.GetZScale

Returns

Number


OverrideAdvancedDialog (GLegExt)
OverrideAdvancedDialog

 Returns TRUE because the GLegExt overrides the advanced properties editor dialog used in the Legend Editor.

Syntax

aGLegExt.OverrideAdvancedDialog

Returns

Boolean


QueryBrightnessRange (GLegExt)
QueryBrightnessRange

 Queries the range of brightness values.

minBrightness and maxBrightness are changed to the current values set for the minimum and maximum brightness range of aGLegExt.

Syntax

aGLegExt.QueryBrightnessRange (minBrightness, maxBrightness)


SetBase (GLegExt)
SetBase

 Sets the surface base gtheme

Syntax

aGLegExt.SetBase (aObj)


SetBrightnessRange (GLegExt)
SetBrightnessRange

 Sets the range of brightness values. The minimum cell value in the brightness Grid is mapped to minBrightness, the maximum cell value in the brightness Grid is mapped to maxBrightness. Brightness values should be in the range 0 to 100.

Syntax

aGLegExt.SetBrightnessRange (minBrightness, maxBrightness)


SetBrightnessThemeName (GLegExt)
SetBrightnessThemeName

 Sets the brightness GTheme for aGLegExt to be the specified GTheme name.

The minimum cell value in the brightness theme is mapped to an intensity of 0, and the maximum cell value in the brightness theme is mapped to an intensity of 100. Values in between are linearly scaled to intensities.

Syntax

aGLegExt.SetBrightnessThemeName (aGThemeName)


SetBrightnessThemeView (GLegExt)
SetBrightnessThemeView

 Sets the View containing the brightness GTheme.

Syntax

aGLegExt.SetBrightnessThemeView (aView)


SetOffSet (GLegExt)
SetOffSet

 Sets the z offset for the surface base gtheme

Syntax

aGLegExt.SetOffSet (aDoublePtr)


SetZScale (GLegExt)
SetZScale

 Sets the z factor for the surface base gtheme

Syntax

aGLegExt.SetZScale (aDoublePtr)


ShowAdvancedDialog (GLegExt)
ShowAdvancedDialog

 Shows the advanced properties editor dialog used to edit the GLegExt properties for theOwningTheme.

theOwningTheme must be a GTheme.

Syntax

aGLegExt.ShowAdvancedDialog (theOwningTheme)


GridLegendWindow

 This class provides a dialog for specifying the advanced options for GTheme Legends.

Inherits From

ModalDialog

Class Requests

GridLegendWindow

Show ( aGridLegendExtension, aGTheme )

__________

See also

Grid
Legend
GTheme


Show (GridLegendWindow)
Show

 Shows the modal window used to edit GridLegendExtensions.

aGTheme is the GTheme whose Legend has the extension.

Syntax

GridLegendWindow.Show (aGridLegendExtension, aGTheme)


Grid
Discussion	Related Topics

 A Grid is an object that stores spatial data in a locational (or raster) data format in which space is partitioned into square cells, and each cell stores a numeric data value.

Grids are disk based data objects, each Grid object is associated with a data set on disk in the tiled raster ARC/INFO GRID format.

Grids are either integer or floating point, integer Grids may be associated with a Value Attribute Table (VAT) that stores attributes defined on the set of cell values in the Grid.

A Grid exists in a Cartesian coordinate system, and the rows and columns in the Grid are parallel to the axes of the coordinate system. Grids that are used for joint analysis need not be at the same resolution or cover exactly the same spatial area but they must be in the same map projection.

The Grid class provides a large number of analysis requests. Analysis requests operate on the Grid that is the target of the request and generate a new resultant Grid with an associated grid data set on disk. Grids created as the result of an analysis request will, in general, be associated with a temporary grid data set that stores the resulting spatial data. It is the clients responsibility to save the grid data set associated with a Grid to a permanent workspace using the aGrid.SaveDataSet request if such an action is needed.

Please see the Discussion topic for this class for information on evaluation, error checking, temporary data sets, and analysis.

Some Grid requests are only available with the Spatial Analyst. If a request is only available with the Spatial Analyst it will be noted with the help for that request.

Inherits From

Obj

Enumerations

GridEnvTypeEnum

GridResTypeEnum

GridStaTypeEnum

GridGeomDescEnum

GridSortTypeEnum

GridVerifyEnum

GridFilterTypeEnum

GridSliceTypeEnum

GridDensTypeEnum

Class Requests

Grid

CalcPolynomialFit ( aLinkList, anOrder, aCoefFN, anErrorFN, backTransform ) :  List

CanManageDataSet  :  Boolean

CopyDataSet ( srcGridFN, destGridFN ) :  Boolean

DeleteDataSet ( aGridFN ) :  Boolean

GetAnalysisCellSize ( aCellSize ) :  GridEnvTypeEnum

GetAnalysisExtent ( aRect ) :  GridEnvTypeEnum

GetAnalysisMask  :  Grid

GetDataSetName  :  String

GetNoDataTransparency  :  Number

GetVerify  :  GridVerifyEnum

IsValidDataSetFileName ( aFileName ) :  Boolean

Make ( aSrcName ) :  Grid

MakeByInterpolation ( ptFTab, aPrj, zField, anInterp, gridSize ) :  Grid

MakeDensitySurface ( ptFTab, aPrj, aField, densitySpec, gridSize ) :  Grid

MakeFromASCII ( aFileName, useFloat ) :  Grid

MakeFromDEM ( aFileName ) :  Grid

MakeFromDTED ( aFileName ) :  Grid

MakeFromFloat ( aFileName ) :  Grid

MakeFromFTab ( anFTab, aPrj, aField, gridSize ) :  Grid

MakeFromImage ( aFileName, aBand ) :  Obj

MakeFromNumb ( aNumb ) :  Grid

MakeFromPointStats ( ptFTab, aPrj, aField, statsSpec, gridSize ) :  Grid

MakeNormal  :  Grid

MakeRandom  :  Grid

MakeSrcName ( aString ) :  SrcName

RenameDataSet ( srcGridFn, destGridFn ) :  Boolean

Reset

SetAnalysisCellSize ( aGridEnvTypeEnum, aCellSize )

SetAnalysisExtent ( aGridEnvTypeEnum, aRect )

SetAnalysisMask ( maskGrid )

SetNoDataTransparency ( maxPercentNoData )

SetVerify ( aGridVerifyEnum )

Instance Requests

Querying the Attributes of a Grid

CellValue ( aPoint, aPrj ) :  Number

CellValueList ( aPointList, aPrj ) :  List

GetCellSize  :  Number

GetExtent  :  Rect

GetNumRowsAndCols  :  List

GetSrcName  :  SrcName

GetStatistics  :  List

GetVTab  :  VTab

HasError  :  Boolean

IsInteger  :  Boolean

PointValue ( aPoint, aPrj ) :  Number

PointValueList ( aPointList, aPrj ) :  List

Grid data set Management

HasTempDataSet  :  Boolean

Rename ( aNewFN )

SaveAsASCII ( aFileName )

SaveAsFloat ( aFileName )

SaveDataSet ( aNewFN ) :  Boolean

Grid Maintance Functions

BuildSTA  :  Boolean

BuildVAT  :  Boolean

Cross Tabulating Area

TabulateArea ( colField, rowObj, rowPrj, rowField, switchColRow ) :  VTab

Operators

! anotherGrid :  Grid

% anotherGrid :  Grid

& anotherGrid :  Grid

* anotherGrid :  Grid

+ anotherGrid :  Grid

- anotherGrid :  Grid

/ anotherGrid :  Grid

< anotherGrid :  Grid

<< anotherGrid :  Grid

<= anotherGrid :  Grid

<> anotherGrid :  Grid

= anotherGrid :  Grid

> anotherGrid :  Grid

>= anotherGrid :  Grid

>> anotherGrid :  Grid

And anotherGrid :  Grid

~  :  Grid

Negate  :  Grid

Not  :  Grid

Or anotherGrid :  Grid

XOr anotherGrid :  Grid

^ anotherGrid :  Grid

| anotherGrid :  Grid

Local Trigonometric Functions

ACos  :  Grid

ACosH  :  Grid

ASin  :  Grid

ASinH  :  Grid

ATan  :  Grid

ATan2 ( yGrid ) :  Grid

ATanH  :  Grid

Cos  :  Grid

CosH  :  Grid

Sin  :  Grid

SinH  :  Grid

Tan  :  Grid

TanH  :  Grid

Local Exponential and Logarithmic Functions

Exp  :  Grid

Exp10  :  Grid

Exp2  :  Grid

Log  :  Grid

Log10  :  Grid

Log2  :  Grid

Pow ( anotherGrid ) :  Grid

Sqr  :  Grid

Sqrt  :  Grid

Local Arithmetic Functions

Abs  :  Grid

Ceil  :  Grid

Float  :  Grid

Floor  :  Grid

FMod ( anotherGrid ) :  Grid

Int  :  Grid

Local Statistics

EqualTo ( aGridList ) :  Grid

GridsGreaterThan ( aGridList ) :  Grid

GridsLessThan ( aGridList ) :  Grid

LocalStats ( aGridStaTypeEnum, aGridList ) :  Grid

Local Reclassification

Lookup ( aFieldName ) :  Grid

Reclass ( aVTab, frmField, toField, outField, noData ) :  Grid

ReclassByClassList ( aFieldName, aClassList, noData ) :  Grid

Slice ( aGridSliceTypeEnum, numZones, baseZone ) :  Grid

Extracting Cells

ExtractByAttributes ( aVTabQueryString ) :  Grid

ExtractByCircle ( aCircle, aPrj, selectOutside ) :  Grid

ExtractByMask ( maskGrid ) :  Grid

ExtractByPoints ( aMPoint, aPrj, selectOutside ) :  Grid

ExtractByPolygon ( aPolygon, aPrj, selectOutside ) :  Grid

ExtractByRect ( aRect, aPrj, selectOutside ) :  Grid

ExtractSelection  :  Grid

Test ( aVTabQueryString ) :  Grid

Local Condition Checking

Con ( yesGrid, noGrid ) :  Grid

IsNull  :  Grid

Pick ( aGridList ) :  Grid

SetNull ( anotherGrid ) :  Grid

Other Global Functions

Combine ( aGridList ) :  Grid

Merge ( aGridList ) :  Grid

Mosaic ( aGridList ) :  Grid

Sample ( aGridList ) :  VTab

Focal and Block Statistics

BlockStats ( aGridStaTypeEnum, aNbrHood, noData ) :  Grid

Filter ( aGridFilterTypeEnum, noData ) :  Grid

FocalStats ( aGridStaTypeEnum, aNbrHood, noData ) :  Grid

Other Focal Functions

FocalFlow ( aThreshold ) :  Grid

Zonal Statistics

ZonalStats ( aGridStaTypeEnum, zoneObj, zonePrj, zoneField, noData ) :  Grid

ZonalStatsTable ( zoneObj, zonePrj, zonefield, noData, outFN ) :  VTab

Zonal Geometry

ZonalGeometry ( aGridGeomDescEnum ) :  Grid

ZonalGeometryTable ( outFN ) :  VTab

Other Zonal Functions

ZonalFill ( weightGrid ) :  Grid

Geometric Transformation

Aggregate ( aCellFactor, aGridStaTypeEnum, noExpand, noData ) :  Grid

Flip  :  Grid

Mirror  :  Grid

Resample ( aCellSize, aGridResTypeEnum ) :  Grid

Rotate ( anAngle, aGridResTypeEnum ) :  Grid

Shift ( newOrigin, aCellSize ) :  Grid

Warp ( aLinkList, anOrder, aGridResTypeEnum, aCellSize ) :  Grid

Surface Functions

Aspect  :  Grid

Contour ( aFN, anInterval, baseContour, aPrj ) :  FTab

ContourList ( aFN, aList, aPrj ) :  FTab

Curvature ( proCurvFN, planCurvFN, slopeFN, aspectFN ) :  Grid

CutFill ( afterGrid, zFactor ) :  Grid

FlowAccumulation ( weightGrid ) :  Grid

FlowDirection ( forceEdge ) :  Grid

FlowLength ( weightGrid, upStream ) :  Grid

HillShade ( anAzimuth, anAltitude, zFactor ) :  Grid

QueryContour ( aPoint, zValue, anArc, aPrj ) :  Boolean

ReturnContour ( aPoint, zValue, aPrj ) :  PolyLine

Sink  :  Grid

Slope ( zFactor, percentRise ) :  Grid

SnapPourPoint ( weightGrid, snapDistance ) :  Grid

StreamLink ( dirGrid ) :  Grid

StreamOrder ( dirGrid, shreveMethod ) :  Grid

Visibility ( anFTab, aPrj, cellObserved ) :  Grid

Watershed ( srcGrid ) :  Grid

Morphological Functions

BoundaryClean ( aGridSortTypeEnum, onceOnly ) :  Grid

Expand ( numberCells, aZoneValueList ) :  Grid

MajorityFilter ( diagNbrs, halfOk ) :  Grid

Nibble ( maskGrid, dataOnly ) :  Grid

RegionGroup ( noDiagNbrs, crossClass, excludedValue ) :  Grid

Shrink ( numberCells, aZoneValueList ) :  Grid

Thin ( notBinary, doFilter, sharpenCorners, maxThickness ) :  Grid

Distance Functions

CostDistance ( costGrid, directionFN, allocationFN, maxDistance ) :  Grid

CostPath ( distanceGrid, directionGrid, byZone ) :  Grid

EucAllocation ( distanceFN, directionFN, maxDistance ) :  Grid

EucDistance ( directionFN, allocationFN, maxDistance ) :  Grid

ReturnCostPath ( directionGrid, aPoint ) :  PolyLine

Raster-to-Vector Conversion Functions

AsPointFTab ( aFileName, aPrj ) :  FTab

AsPolygonFTab ( aFileName, performWeeding, aPrj ) :  FTab

AsPolyLineFTab ( aFileName, notBinary, performWeeding, aPrj ) :  FTab

StreamToPolyLineFTab ( aFileName, dirGrid, performWeeding, aPrj ) :  FTab

__________

See also

GTheme
NbrHood
Interp
SrcName
Radius
SVGram
FTab
Number
VTab


CalcPolynomialFit (Grid)
CalcPolynomialFit

 Performs a linear least squares fit to the List of links aLinkList. This request can used to test the goodness of fit for a polynomial transformation that will be done with the request aGrid.Warp.

aLinkList - a List of Line objects in which the start point for each Line defines the current x,y coordinates for that point on aGrid, and the end point defines the desired coordinates for the point.

anOrder - a Number from 1 to 12 defining the polynomial order.

anCoefFN - a FileName defining the file name for the dBASE file that will store the polynomial coefficients.

anErrorFN - a FileName defining the file name for the dBASE file that will store link errors.

backTransform - a BoolEnum defining whether a forward (FALSE) or backward (TRUE) transformation is done.

The output is a List of 6 objects in the following order:

      0: coefficientsVTab : VTab
      1: linkErrorVTab : VTab
      2: totalXRMSError : Number
      3: totalYRMSError : Number
      4: xChiSquare : Number
      5: yChiSquare : Number

coefficentsVTab - a VTab with the following Fields: Coef #, X Coef, and Y Coef. There will be a record for each coefficient in the transformation. It is created as a dBASE file in the working directory with the name given with aCoefFN.

linkErrorVTab - a VTab with the following Fields: Link-id, Input X, Input Y, Output X, Output Y, X Error, and Y Error. There will be a record for each Line (link) in aLinkList. In a forward transformation the Input X and Y fields are recorded in From coordinate units, and the Output X and Y fields and the X and Y Error fields are recorded in To coordinate units. In a backward transformation the Input X and Y fields and the X and Y Error fields are recorded in To coordinate units, and the Output X and Y fields are recorded in From coordinate units. It is created as a dBASE file in the working directory with the name given with anErrorFN.

totalXRMSError - the total RMS error in the x direction (recorded in To coordinate units in a forward transformation and From coordinate units in a backward transformation).

totalYRMSError - the total RMS error in the y direction (recorded in To coordinate units in a forward transformation and From coordinate units in a backward transformation).

xChiSquare - the Chi-Square value for error in the x direction.

yChiSquare - the Chi-Square value for error in the y direction.

This request is only available with the Spatial Analyst.

Syntax

Grid.CalcPolynomialFit (aLinkList, anOrder, aCoefFN, anErrorFN, backTransform)

Returns

List


CanManageDataSet (Grid)
CanManageDataSet

Returns TRUE if the class supports data set management on disk.

Syntax

Grid.CanManageDataSet

Returns

Boolean


CopyDataSet (Grid)
CopyDataSet

Copies a grid data set named srcGridFN to a grid data set named desGridFN.

Returns TRUE if it succeeded, otherwise FALSE.

Syntax

Grid.CopyDataSet (srcGridFN, destGridFN)

Returns

Boolean


DeleteDataSet (Grid)
DeleteDataSet

Deletes a grid data set named aGridFN.

Returns TRUE if it succeeded, otherwise FALSE.

Syntax

Grid.DeleteDataSet (aGridFN)

Returns

Boolean


GetAnalysisCellSize (Grid)
GetAnalysisCellSize

Gets the current Spatial Analyst extension's analysis environment cell size.

Returns a GridEnvTypeEnum indicating the state of the analysis environment's cell size. aCellSize is set to Nil if the GridEnvTypeEnum is set to #GRID_ENVTYPE_MINOF or #GRID_ENVTYPE_MAXOF.

This request is only available with the Spatial Analyst.

Syntax

Grid.GetAnalysisCellSize (aCellSize)

Returns

GridEnvTypeEnum


GetAnalysisExtent (Grid)
GetAnalysisExtent

Gets the current Spatial Analyst extension's analysis environment extent.

Returns a GridEnvTypeEnum indicating the state of the analysis environment's extent. aRect is set to Nil if the GridEnvTypeEnum is set to #GRID_ENVTYPE_MINOF or #GRID_ENVTYPE_MAXOF.

This request is only available with the Spatial Analyst.

Syntax

Grid.GetAnalysisExtent (aRect)

Returns

GridEnvTypeEnum


GetAnalysisMask (Grid)
GetAnalysisMask

Gets the current mask set for the Spatial Analyst extension's analysis environment.

Returns NIL if a mask has not been set. Use the following example to check if a mask has been set before using it.

      theMaskGrid = Grid.GetAnalysisMask
      if (theMaskGrid.Is(Grid)) then
        MsgBox.Info("Mask is set","Mask Status")
      else
        MsgBox.Info("Mask is NOT set","Mask Status")
      end

This request is only available with the Spatial Analyst.

Syntax

Grid.GetAnalysisMask

Returns

Grid


GetDataSetName (Grid)
GetDataSetName

Returns the data set name of Grid Class

Syntax

Grid.GetDataSetName

Returns

String


GetNoDataTransparency (Grid)
GetNoDataTransparency

Gets the percentage value for the number of No Data cells in a Grid needed before the null symbol in the default Legend for GThemes is display transparently.

Syntax

Grid.GetNoDataTransparency

Returns

Number


GetVerify (Grid)
GetVerify
Example

Gets the type of verification that is used if you try to overwrite an existing grid data set.

Syntax

Grid.GetVerify

Returns

GridVerifyEnum


IsValidDataSetFileName (Grid)
IsValidDataSetFileName

Returns TRUE if aFileName is valid FileName for the Grid class.

Syntax

Grid.IsValidDataSetFileName (aFileName)

Returns

Boolean


Make (Grid)
Make

Makes a Grid from aSrcName. aSrcName should be created with Grid.MakeSrcName and not SrcName.Make. This request will only work with SrcNames created from Grid.MakeSrcName.

Syntax

Grid.Make (aSrcName)

Returns

Grid


MakeByInterpolation (Grid)
MakeByInterpolation
Example

 Makes a Grid by interpolating points in ptFTab using anInterp as the interpolation method.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

zField must be a numeric field found in ptFTab.

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

Syntax

Grid.MakeByInterpolation (ptFTab, aPrj, zField, anInterp, gridSize)

Returns

Grid


MakeDensitySurface (Grid)
MakeDensitySurface
Discussion	Example

 Makes a Grid from the points in ptFTab using a density function.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField provides the frequency to use at each point during the density calculation. It can be a numeric Field found in ptFTab or Nil. If Nil is used a frequency of 1 is used at each point.

densitySpec is a List of 3 objects. It contains the following:

      0: the density function type (GridDensTypeEnum)
      1: the radius to search for input points (Number)
      2: a unit scale factor for area (Number)

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

This request is only available with the Spatial Analyst.

Syntax

Grid.MakeDensitySurface (ptFTab, aPrj, aField, densitySpec, gridSize)

Returns

Grid


MakeFromASCII (Grid)
MakeFromASCII
Discussion

Makes a Grid from an ASCII formatted raster file named aFileName.

If useFloat is TRUE, a floating point Grid is created. If useFloat is FALSE, an integer Grid is created.

Syntax

Grid.MakeFromASCII (aFileName, useFloat)

Returns

Grid


MakeFromDEM (Grid)
MakeFromDEM
Discussion

Makes a Grid from a USGS DEM file named aFileName.

Syntax

Grid.MakeFromDEM (aFileName)

Returns

Grid


MakeFromDTED (Grid)
MakeFromDTED
Discussion

Makes a Grid from a DTED file named aFileName.

Syntax

Grid.MakeFromDTED (aFileName)

Returns

Grid


MakeFromFloat (Grid)
MakeFromFloat
Discussion

Makes a Grid from a binary floating point formatted raster file named aFileName.

Syntax

Grid.MakeFromFloat (aFileName)

Returns

Grid


MakeFromFTab (Grid)
MakeFromFTab
Discussion	Example

Makes a Grid by rasterizing features in anFTab. If there is a selection on anFTab, then only selected features are converted, otherwise, all features are converted.

aPrj defines the map projection that features in anFTab should be converted to before being rasterized. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField defines the Field in anFTab that will give the cells that intersect or are contained within features their value. Cells that don't intersect or aren't contained within any features are given the value of No Data. aField must be a numeric or string Field, or Nil. If Nil is used, then cells are assigned the value of 1.

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to GRID_ENVTYPE_VALUE.

Syntax

Grid.MakeFromFTab (anFTab, aPrj, aField, gridSize)

Returns

Grid


MakeFromImage (Grid)
MakeFromImage

 Converts an image to Grid(s).

aFileName is the FileName for the image that you want to convert.

aBand is the Number of the band in the image that you want to convert. If you want to convert all bands in an image to Grids set aBand equal to 0.

Returns a List of Grids if aBand is set to 0. Otherwise a Grid is returned.

Syntax

Grid.MakeFromImage (aFileName, aBand)

Returns

Obj


MakeFromNumb (Grid)
MakeFromNumb

Makes a Grid of uniform values from aNumb.

This request is only available with the Spatial Analyst.

Syntax

Grid.MakeFromNumb (aNumb)

Returns

Grid


MakeFromPointStats (Grid)
MakeFromPointStats
Discussion	Example

 Makes a Grid by calculating neighborhood statistics on the points in ptFTab.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField provides the value of each point to use during the calculation. It can be a numeric Field found in ptFTab or Nil. If Nil is used a frequency of 1 is used at each point.

statsSpec is a List of 2 objects. It contains the following:

      0: the type statistic (GridStaTypeEnum)
      1: the type of neighborhood (NbrHood)

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

This request is only available with the Spatial Analyst.

Syntax

Grid.MakeFromPointStats (ptFTab, aPrj, aField, statsSpec, gridSize)

Returns

Grid


MakeNormal (Grid)
MakeNormal

Makes a Grid with normally distributed random values. The normal distribution uses a mean of 0 and a standard deviation of 1 to create the random values.

This request is only available with the Spatial Analyst.

Syntax

Grid.MakeNormal

Returns

Grid


MakeRandom (Grid)
MakeRandom

Makes a Grid with uniformly distributed random values. Random values are between 0 and 1.

This request is only available with the Spatial Analyst.

Syntax

Grid.MakeRandom

Returns

Grid


MakeSrcName (Grid)
MakeSrcName

Makes a SrcName from aString.

Syntax

Grid.MakeSrcName (aString)

Returns

SrcName


RenameDataSet (Grid)
RenameDataSet

Renames a grid data set named srcGridFN to a grid data set named destGridFN.

Returns TRUE if it succeeded, otherwise FALSE.

Syntax

Grid.RenameDataSet (srcGridFn, destGridFn)

Returns

Boolean


Reset (Grid)
Reset

Resets the Spatial Analyst extension's analysis environment to its default setting. Both the analysis cell size and extent is set to #GRID_ENVTYPE_MAXOF. The analysis environment mask is set to no mask.

This request is only available with the Spatial Analyst.

Syntax

Grid.Reset


SetAnalysisCellSize (Grid)
SetAnalysisCellSize

Sets the Spatial Analyst extension's analysis environment cell size to aCellSize. If aGridEnvTypeEnum is set to #GRID_ENVTYPE_MINOF or #GRID_ENVTYPE_MAXOF then aCellSize should be Nil. Otherwise it is a Number.

This request is only available with the Spatial Analyst.

Syntax

Grid.SetAnalysisCellSize (aGridEnvTypeEnum, aCellSize)


SetAnalysisExtent (Grid)
SetAnalysisExtent

Sets the Spatial Analyst extension's analysis environment extent to aRect. If aGridEnvTypeEnum is set to #GRID_ENVTYPE_MINOF or #GRID_ENVTYPE_MAXOF then aRect should be Nil. Otherwise it is a Rect.

This request is only available with the Spatial Analyst.

Syntax

Grid.SetAnalysisExtent (aGridEnvTypeEnum, aRect)


SetAnalysisMask (Grid)
SetAnalysisMask

Sets the Spatial Analyst extension's analysis environment mask to maskGrid. All cells with No Data values in maskGrid will have No Data values in the result of an operation.

This request is only available with the Spatial Analyst.

Syntax

Grid.SetAnalysisMask (maskGrid)


SetNoDataTransparency (Grid)
SetNoDataTransparency

Sets the percentage of No Data cells needed in a Grid to make the null symbol in the default Legends for GThemes to display transparently.

Syntax

Grid.SetNoDataTransparency (maxPercentNoData)


SetVerify (Grid)
SetVerify
Example

Sets the type of verification to use if you try to overwrite an existing grid data set to aGridVerifyEnum.

Syntax

Grid.SetVerify (aGridVerifyEnum)


CellValue (Grid)
CellValue

Returns the value of the cell in aGrid that contains aPoint.

aPrj defines the map projection that the point should be converted to before being used. If the point is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.CellValue (aPoint, aPrj)

Returns

Number


CellValueList (Grid)
CellValueList

Returns a List of Numbers representing the values of the cells in aGrid that contain the points in aPointList.

aPointList is a List of Point objects.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.CellValueList (aPointList, aPrj)

Returns

List


GetCellSize (Grid)
GetCellSize

Gets the cell size of aGrid in map space.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetCellSize

Returns

Number


GetExtent (Grid)
GetExtent

Gets the extent of aGrid in map space.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetExtent

Returns

Rect


GetNumRowsAndCols (Grid)
GetNumRowsAndCols

Gets the number of rows and columns in aGrid, as a List of two Numbers.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetNumRowsAndCols

Returns

List


GetSrcName (Grid)
GetSrcName

Gets the source name for aGrid

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetSrcName

Returns

SrcName


GetStatistics (Grid)
GetStatistics

Gets a List of statistics as Numbers for aGrid. The List will contain the minimum, maximum, mean, and standard deviation values for aGrid in that order.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetStatistics

Returns

List


GetVTab (Grid)
GetVTab

Gets the VTab for the Value Attribute Table (VAT) of aGrid. If aGrid does not have a VAT it will return Nil.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.GetVTab

Returns

VTab


HasError (Grid)
HasError

Returns TRUE if aGrid has an error, otherwise FALSE. Make sure that aGrid has been evaluated. See the Discussion topic for more information on checking for errors and evaluation.

Syntax

aGrid.HasError

Returns

Boolean


IsInteger (Grid)
IsInteger

Returns TRUE if aGrid is an integer Grid.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.IsInteger

Returns

Boolean


PointValue (Grid)
PointValue
Discussion

Returns an interpolated value for aPoint on the surface defined by aGrid.

aPrj defines the map projection that the point should be converted to before being used. If the point is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.PointValue (aPoint, aPrj)

Returns

Number


PointValueList (Grid)
PointValueList
Discussion

Returns a List of Numbers representing interpolated values for each point in aPointList on the surface defined by aGrid.

aPointList is a List of Point objects.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.PointValueList (aPointList, aPrj)

Returns

List


HasTempDataSet (Grid)
HasTempDataSet

Returns TRUE if the disk data set associated with aGrid is marked as temporary. If TRUE, then the associated data set is deleted when aGrid is deleted.

Syntax

aGrid.HasTempDataSet

Returns

Boolean


Rename (Grid)
Rename

Renames the data set associated with aGrid to aNewFN. Using this request does not change the return for the aGrid.HasTempDataSet request. The data set associated with aGrid is still temporary and is deleted when aGrid is deleted.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.Rename (aNewFN)


SaveAsASCII (Grid)
SaveAsASCII
Discussion

Saves aGrid as a raster ASCII file named aFileName.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.SaveAsASCII (aFileName)


SaveAsFloat (Grid)
SaveAsFloat
Discussion

Saves aGrid as a raster binary floating point file named aFileName.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.SaveAsFloat (aFileName)


SaveDataSet (Grid)
SaveDataSet

Saves the data set for aGrid to a new disk data set named aNewFN. Using this request changes the aGrid.HasTempDataSet request to return FALSE and marks the new associated data set as permanent.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.SaveDataSet (aNewFN)

Returns

Boolean


BuildSTA (Grid)
BuildSTA

Builds the statistics for aGrid.

TRUE is returned if the operation is successful, otherwise FALSE is returned.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.BuildSTA

Returns

Boolean


BuildVAT (Grid)
BuildVAT

Builds the VTab (Value Attribute Table) for aGrid, if aGrid is an integer Grid.

TRUE is returned if the operation is successful, otherwise FALSE is returned.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.BuildVAT

Returns

Boolean


TabulateArea (Grid)
TabulateArea
Example

 Computes cross tabulated areas between two data sets. There will be a Field for each unique value of colField and a record for each unique value of rowField in the output VTab. Each record will store the area of each attribute stored in colGrid within the features of rowObj that have the same values.

rowObj can be a Grid or a FTab.

zonePrj defines the map projection that features in zoneObj should be converted to before being used if zoneObj is a FTab. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If switchColRow is TRUE, then the row data set is treated as the column data set, and the column data set as row data set.

This request is only available with the Spatial Analyst.

Syntax

colGrid.TabulateArea (colField, rowObj, rowPrj, rowField, switchColRow)

Returns

VTab


! (Grid)
!

Returns the bitwise XOR of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid ! anotherGrid

Returns

Grid


% (Grid)
%

Returns the integer remainder produced by dividing aGrid by anotherGrid (modulo) on a per-cell basis. The aGrid.FMod request can be used to calculate the remainder between two floating point Grids.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid % anotherGrid

Returns

Grid


& (Grid)
&

Returns the bitwise AND of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid & anotherGrid

Returns

Grid


* (Grid)
*

Multiplies aGrid by anotherGrid returning the product on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid * anotherGrid

Returns

Grid


+ (Grid)
+

Adds aGrid to anotherGrid returning the sum on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid + anotherGrid

Returns

Grid


- (Grid)
-

Subtracts aGrid by anotherGrid returning the difference on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid - anotherGrid

Returns

Grid


/ (Grid)
/

Divides aGrid by anotherGrid returning the quotient on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid / anotherGrid

Returns

Grid


< (Grid)
<

Evaluates the less than relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid < anotherGrid

Returns

Grid


<< (Grid)
<<

Returns the result of a bitwise left-shift on aGrid by the amount specified in anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid << anotherGrid

Returns

Grid


<= (Grid)
<=

Evaluates the less than or equal to relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid <= anotherGrid

Returns

Grid


<> (Grid)
<>

Evaluates the not equal to relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid <> anotherGrid

Returns

Grid


= (Grid)
=

Evaluates the equal to relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid = anotherGrid

Returns

Grid


> (Grid)
>

Evaluates the greater than relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid > anotherGrid

Returns

Grid


>= (Grid)
>=

Evaluates the greater than or equal to relation on aGrid and anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid >= anotherGrid

Returns

Grid


>> (Grid)
>>

Returns the result of a bitwise right-shift on aGrid by the amount specified in anotherGrid on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid >> anotherGrid

Returns

Grid


And (Grid)
And

Returns the logical AND of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid And anotherGrid

Returns

Grid


~ (Grid)
~

Returns bitwise complement of aGrid on a per-cell basis.

This request is only available with the Spatial Analyst.

Syntax

aGrid.~

Returns

Grid


Negate (Grid)
Negate

Returns the negated value of aGrid on a per-cell basis. Preferred usage: -aGrid

This request is only available with the Spatial Analyst.

Syntax

aGrid.Negate

Returns

Grid


Not (Grid)
Not

Returns the logical complement of aGrid on a per-cell basis. Preferred usage: Not aGrid

This request is only available with the Spatial Analyst.

Syntax

aGrid.Not

Returns

Grid


Or (Grid)
Or

Returns the logical OR of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid Or anotherGrid

Returns

Grid


XOr (Grid)
XOr

Returns the logical XOR of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid XOr anotherGrid

Returns

Grid


^ (Grid)
^

Raises aGrid to the power of anotherGrid on a per-cell basis. This is the same as the aGrid.Pow request.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid ^ anotherGrid

Returns

Grid


| (Grid)
|

Returns the bitwise OR of two Grids on a per-cell basis.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid | anotherGrid

Returns

Grid


ACos (Grid)
ACos

Calculates the inverse cosine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ACos

Returns

Grid


ACosH (Grid)
ACosH

Calculates the inverse hyperbolic cosine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ACosH

Returns

Grid


ASin (Grid)
ASin

Calculates the inverse sine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ASin

Returns

Grid


ASinH (Grid)
ASinH

Calculates the inverse hyperbolic sine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ASinH

Returns

Grid


ATan (Grid)
ATan

Calculates the inverse tangent for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ATan

Returns

Grid


ATan2 (Grid)
ATan2

Calculates the inverse tangent (based on xGrid / yGrid) for each cell of xGrid and yGrid. Input values are interpreted as radians.

yGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

xGrid.ATan2 (yGrid)

Returns

Grid


ATanH (Grid)
ATanH

Calculates the inverse hyperbolic tangent for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ATanH

Returns

Grid


Cos (Grid)
Cos

Calculates the cosine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Cos

Returns

Grid


CosH (Grid)
CosH

Calculates the hyperbolic cosine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.CosH

Returns

Grid


Sin (Grid)
Sin

Calculates the sine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Sin

Returns

Grid


SinH (Grid)
SinH

Calculates the hyperbolic sine for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.SinH

Returns

Grid


Tan (Grid)
Tan

Calculates the tangent for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Tan

Returns

Grid


TanH (Grid)
TanH

Calculates the hyperbolic tangent for each cell of aGrid. Input values are interpreted as radians.

This request is only available with the Spatial Analyst.

Syntax

aGrid.TanH

Returns

Grid


Exp (Grid)
Exp

Calculates the base e exponential for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Exp

Returns

Grid


Exp10 (Grid)
Exp10

Calculates the base 10 exponential for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Exp10

Returns

Grid


Exp2 (Grid)
Exp2

Calculates the base 2 exponential for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Exp2

Returns

Grid


Log (Grid)
Log

Calculates the natural logarithm for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Log

Returns

Grid


Log10 (Grid)
Log10

Calculates the base 10 logarithm for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Log10

Returns

Grid


Log2 (Grid)
Log2

Calculates the base 2 logarithm for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Log2

Returns

Grid


Pow (Grid)
Pow

Raises aGrid to the power of anotherGrid on a per-cell basis. Preferred usage: aGrid ^ anotherGrid.

anotherGrid can be a Grid or a Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Pow (anotherGrid)

Returns

Grid


Sqr (Grid)
Sqr

Calculates the square of each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Sqr

Returns

Grid


Sqrt (Grid)
Sqrt

Calculates the square root of each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Sqrt

Returns

Grid


Abs (Grid)
Abs

Calculates the absolute value for each cell of aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Abs

Returns

Grid


Ceil (Grid)
Ceil

For each cell, returns the next highest whole value greater than or equal to aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Ceil

Returns

Grid


Float (Grid)
Float

Converts each cell of aGrid to a floating point value.

Syntax

aGrid.Float

Returns

Grid


Floor (Grid)
Floor

For each cell, returns the greatest integer value less than or equal to aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Floor

Returns

Grid


FMod (Grid)
FMod

For each cell, returns the floating point remainder after dividing aGrid by anotherGrid. The operator % can be used to calculate the integer remainder between two Grids.

anotherGrid can be a Grid or Number. If it is a Number it is automatically converted to a Grid. For more information on using Grids and Numbers together in mathematical statements, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FMod (anotherGrid)

Returns

Grid


Int (Grid)
Int

Converts each cell of aGrid to an integer value by truncating at the decimal point.

Syntax

aGrid.Int

Returns

Grid


EqualTo (Grid)
EqualTo

For each cell, returns the number of Grids in aGridList equal to aGrid.

aGridList is a List of Grid objects.

This request is only available with the Spatial Analyst.

Syntax

aGrid.EqualTo (aGridList)

Returns

Grid


GridsGreaterThan (Grid)
GridsGreaterThan

For each cell, returns the number of Grids in aGridList greater than aGrid.

aGridList is a List of Grid objects.

This request is only available with the Spatial Analyst.

Syntax

aGrid.GridsGreaterThan (aGridList)

Returns

Grid


GridsLessThan (Grid)
GridsLessThan

For each cell, returns the number of Grids in aGridList less than aGrid.

aGridList is a List of Grid objects.

This request is only available with the Spatial Analyst.

Syntax

aGrid.GridsLessThan (aGridList)

Returns

Grid


LocalStats (Grid)
LocalStats

For each cell, calculates the statistic specified by aGridStaTypeEnum on aGrid and the List of Grids in aGridList.

This request is only available with the Spatial Analyst.

Syntax

aGrid.LocalStats (aGridStaTypeEnum, aGridList)

Returns

Grid


Lookup (Grid)
Lookup

Creates a new Grid by looking up a new value for each cell in a Field named aFieldName in the VTab for aGrid. It will return a Grid that returns TRUE to the rGrid.HasError request if aGrid doesn't have a VTab.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Lookup (aFieldName)

Returns

Grid


Reclass (Grid)
Reclass

 Reclassifies the value of each cell in aGrid using the specified Fields in aVTab. The return will always be an integer Grid.

Cells with values from the value in frmField to the values in toField are given the value in outField.

If noData is TRUE, any value in aGrid that is not present in aVTab is given a No Data value in the output Grid. If it is FALSE, then values not present will retain their value in the output Grid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Reclass (aVTab, frmField, toField, outField, noData)

Returns

Grid


ReclassByClassList (Grid)
ReclassByClassList
Example

 Reclassifies the values of cells in aGrid using the classification specified by aClassList. The return will always be an integer Grid.

aFieldName is the name of the Field in the VTab of aGrid that the values in aClassList match. If aGrid doesn't have a VTab, then "Value" should be used.

aClassList can be created procedurally or extracted from a Legend object. It is a List of Classification objects. The value property of a Classification describes the set of cell values that should be reclassified to new values. The label property of the Classification describes the output cell value that cell values in the value property are changed to. The label string must represent either a numeric value or the string "No Data". If a Classification is assigned an output value of "No Data", then all cells in aGrid falling into the Classification are reassigned to No Data in the output Grid. The value set for a Classification may also be "No Data". This provides a convenient way of replacing all occurrences of No Data in aGrid with another value.

If noData is TRUE, any value in aGrid that is not present in any of the Classifications is given a No Data value in the output Grid. If it is FALSE, then values not present will retain their value in the output Grid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ReclassByClassList (aFieldName, aClassList, noData)

Returns

Grid


Slice (Grid)
Slice

Slices the values of aGrid into numZones number of equal area or equal interval classes, depending on the setting of aGridSliceTypeEnum. The return will always be an integer Grid.

baseZone defines the lowest zone value to use in the output Grid. It can be a Number or Nil. If Nil is used the value of 1 is used.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Slice (aGridSliceTypeEnum, numZones, baseZone)

Returns

Grid


ExtractByAttributes (Grid)
ExtractByAttributes

 Extracts cells in aGrid using a Boolean VTab query string on the VTab of aGrid. If the query is TRUE, then a cell will retain its value. If the query is FALSE, then the cell is given the value of No Data.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByAttributes (aVTabQueryString)

Returns

Grid


ExtractByCircle (Grid)
ExtractByCircle

 Extracts cells in aGrid using aCircle.

aPrj defines the map projection that aCircle should be converted to before being used. If aCircle is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If selectOutside is TRUE, then the cells outside of aCircle are extracted. If it is FALSE, then the cells inside of aCircle are extracted.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByCircle (aCircle, aPrj, selectOutside)

Returns

Grid


ExtractByMask (Grid)
ExtractByMask

Extracts cells in aGrid whose corresponding cells in maskGrid have a valid value. A valid value is any valid besides No Data.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByMask (maskGrid)

Returns

Grid


ExtractByPoints (Grid)
ExtractByPoints

 Extracts cells in aGrid using aMPoint.

aPrj defines the map projection that aMPoint should be converted to before being used. If aMPoint is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If selectOutside is TRUE, then the cells that do not contain any points in aMPoint are extracted. If it is FALSE, then the cells that contain points in aMPoint are extracted.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByPoints (aMPoint, aPrj, selectOutside)

Returns

Grid


ExtractByPolygon (Grid)
ExtractByPolygon

 Extracts cells in aGrid using aPolygon.

aPrj defines the map projection that aPolygon should be converted to before being used. If aPolygon is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If selectOutside is TRUE, then the cells outside of aPolygon are extracted. If it is FALSE, then the cells inside of aPolygon are extracted.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByPolygon (aPolygon, aPrj, selectOutside)

Returns

Grid


ExtractByRect (Grid)
ExtractByRect

 Extracts cells in aGrid using aRect.

aPrj defines the map projection that aRect should be converted to before being used. If aRect is already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If selectOutside is TRUE, then the cells outside of aRect are extracted. If it is FALSE, then the cells inside of aRect are extracted.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ExtractByRect (aRect, aPrj, selectOutside)

Returns

Grid


ExtractSelection (Grid)
ExtractSelection

Extracts cells in aGrid that fall in the selected zones (rows) of the VTab of aGrid. Cells not selected in the VTab are given No Data values.

Syntax

aGrid.ExtractSelection

Returns

Grid


Test (Grid)
Test

Creates a new Grid by running a Boolean VTab query string on the VTab of aGrid. Cells for which the query is TRUE are given a value of 1 in the new Grid. Cells that are FALSE are given the value of 0.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Test (aVTabQueryString)

Returns

Grid


Con (Grid)
Con
Discussion	Example

For each cell, it returns the value found in yesGrid if aGrid is non-zero (TRUE), otherwise it returns the value found in noGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Con (yesGrid, noGrid)

Returns

Grid


IsNull (Grid)
IsNull
Example

For each cell, it returns the value of 1 (TRUE) if that cell in aGrid has a value of No Data, otherwise, it returns the value of 0 (FALSE).

This request is only available with the Spatial Analyst.

Syntax

aGrid.IsNull

Returns

Grid


Pick (Grid)
Pick

For each cell, returns the cell value from the Grid in aGridList whose position is equal to the value of aGrid.

aGridList is a List of Grid objects.

The position of Grids in aGridList starts with 1. A value of 0 in aGrid will return a No Data value.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Pick (aGridList)

Returns

Grid


SetNull (Grid)
SetNull
Example

For each cell, it returns the No Data value if aGrid is non-zero (TRUE), otherwise it returns the value found in anotherGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.SetNull (anotherGrid)

Returns

Grid


Combine (Grid)
Combine

Generates a Grid of unique values by combining aGrid with the List of Grids in aGridList. The value of aGrid and each Grid in aGridList are placed in a separate Field in the VTab of the output Grid for each unique combination.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Combine (aGridList)

Returns

Grid


Merge (Grid)
Merge
Example

Merges aGrid with the List of Grids in aGridList. The order of aGrid and the Grids in aGridList determines the priority of the cell values used in overlapping areas. aGrid has the highest priority and the last Grid in aGridList will have the lowest priority. Cells with values of No Data cannot mask out other cells with values other than No Data.

Syntax

aGrid.Merge (aGridList)

Returns

Grid


Mosaic (Grid)
Mosaic
Discussion

Mosaics, making a smooth transition over overlapping areas, aGrid with the List of Grids in aGridList.

Syntax

aGrid.Mosaic (aGridList)

Returns

Grid


Sample (Grid)
Sample

Samples a List of Grids in aGridList using only the cells with values other than No Data in aGrid. The output VTab will have a Field for each Grid in aGridList that will hold the value of each sample. There will be a separate record in the VTab for each cell in aGrid that has a value other than No Data.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Sample (aGridList)

Returns

VTab


BlockStats (Grid)
BlockStats
Discussion	Example

Calculates aGridStaTypeEnum for the neighborhood defined by aNbrHood, and returns the value to all the cells in aNbrHood. Neighborhoods do not overlap.

If noData is TRUE, then the output value is No Data if any cells in aNbrHood have the value of No Data. If noData is FALSE, then the No Data cells in the aNbrHood are ignored in the calculation and a value is returned.

This request is only available with the Spatial Analyst.

Syntax

aGrid.BlockStats (aGridStaTypeEnum, aNbrHood, noData)

Returns

Grid


Filter (Grid)
Filter

Performs a focal filter on aGrid using aGridFilterTypeEnum.

If noData is TRUE, then the output value is No Data if any cells in the filters kernel have the value of No Data. If noData is FALSE, then the No Data cells in the kernel are ignored in the calculation and a value is returned.

Syntax

aGrid.Filter (aGridFilterTypeEnum, noData)

Returns

Grid


FocalStats (Grid)
FocalStats
Discussion	Example

Calculates aGridStaTypeEnum for the neighborhood defined by aNbrHood, for each cell. Each cell has a unique overlapping neighborhood.

If noData is TRUE, then the output value is No Data if any cells in aNbrHood have the value of No Data. If noData is FALSE, then the No Data cells in the aNbrHood are ignored in the calculation and a value is returned.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FocalStats (aGridStaTypeEnum, aNbrHood, noData)

Returns

Grid


FocalFlow (Grid)
FocalFlow
Discussion

Determines the flow of the values in aGrid within each cell's immediate neighborhood.

aThreshold defines the minimum drop that must be equaled or exceeded before flow can occur. It can be a Number or Nil. If it is Nil, then the value of 0 is used.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FocalFlow (aThreshold)

Returns

Grid


ZonalStats (Grid)
ZonalStats
Example

 Calculates aGridStaTypeEnum within the zones of zoneObj for each cell in aGrid. Cells that intersect or are contained within the features of zoneObj are used to calculate a statistics for each unique value in zoneField. This value is returned to each cell that is part of that zone.

zoneObj can be a Grid or FTab. If there is a selection on the zoneObj, then only selected features are used, otherwise, all features are used.

zonePrj defines the map projection that features in zoneObj should be converted to before being used if zoneObj is a FTab. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

zoneField is a Field in zoneObj that defines the zones to be used in the calculation of aGridStatTypeEnum.

If noData is TRUE, then the output value for every cell in a zone is No Data if any cells in aGrid contained in that zone are have the value of No Data. If noData is FALSE, then the No Data cells in the zone are ignored in the calculation and a value is returned.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ZonalStats (aGridStaTypeEnum, zoneObj, zonePrj, zoneField, noData)

Returns

Grid


ZonalStatsTable (Grid)
ZonalStatsTable
Example

 Generates a VTab, with FileName outFN, which contains statistics for each unique value (zone) of zoneField in zoneObj.

zoneObj can be a Grid or a FTab. If there is a selection on the zoneObj, then only selected features are used, otherwise, all features are used.

zonePrj defines the map projection that features in zoneObj should be converted to before being used if zoneObj is a FTab. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If noData is TRUE, then a record will not be created in the VTab if any cells in aGrid contained in a zone have the value of No Data. If noData is FALSE then No Data cells in the zone are ignored in the calculation and a record is created.

If aGrid is a floating point Grid the statistics calculated for each zone in zoneObj are: maximum, mean, minimum, range, standard deviation, and sum. If aGrid is an integer Grid, then majority, minority, median, and variety are added to the above statistics.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ZonalStatsTable (zoneObj, zonePrj, zonefield, noData, outFN)

Returns

VTab


ZonalGeometry (Grid)
ZonalGeometry
Discussion

Calculates aGridGeomDescEnum for each zone found in aGrid and returns the value to every cell contained in the zone. All cells with the same value are considered a zone.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ZonalGeometry (aGridGeomDescEnum)

Returns

Grid


ZonalGeometryTable (Grid)
ZonalGeometryTable
Discussion

Generates a VTab, with FileName outFN, that contains geometric descriptors (area, perimeter, thickness, and characteristics of an ellipse fit to the zone) for each zone found in aGrid. All cells with the same value are considered a zone.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ZonalGeometryTable (outFN)

Returns

VTab


ZonalFill (Grid)
ZonalFill
Discussion

Fills zones in aGrid with the minimum value along the zone boundary found in weightGrid. All cells with the same value are considered a zone.

This request is only available with the Spatial Analyst.

Syntax

aGrid.ZonalFill (weightGrid)

Returns

Grid


Aggregate (Grid)
Aggregate
Discussion	Example

 Generates a reduced-resolution copy of aGrid by multiplying the cell size by aCellFactor. The output value of the new cells is calculated using aGridStaTypeEnum with the cells in aGrid contained within each output cell.

If noExpand is TRUE, then the output Grids extent is smaller on the right and bottom if the number of rows or columns is not divisible by aCellFactor. If noExpand is FALSE, then the output Grid's extent is larger on the right and bottom if the number of rows and columns is not divisible by aCellFactor.

If noData is TRUE, then an output cell is set to No Data if any of the cells used to calculate the new value have the value of No Data. If noData is FALSE, then only the cells with values are used to calculate the new value for the output cell.

Only the following aGridStaTypeEnum types are valid with this request:

      #GRID_STATYPE_MAX
      #GRID_STATYPE_MEAN
      #GRID_STATYPE_MEDIAN
      #GRID_STATYPE_MIN
      #GRID_STATYPE_SUM

This request is only available with the Spatial Analyst.

Syntax

aGrid.Aggregate (aCellFactor, aGridStaTypeEnum, noExpand, noData)

Returns

Grid


Flip (Grid)
Flip

Flips aGrid in the Y direction.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Flip

Returns

Grid


Mirror (Grid)
Mirror

Mirrors aGrid in the X direction.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Mirror

Returns

Grid


Resample (Grid)
Resample
Discussion

Resamples aGrid to aCellSize using aGridResTypeEnum as the resampling technique.

Syntax

aGrid.Resample (aCellSize, aGridResTypeEnum)

Returns

Grid


Rotate (Grid)
Rotate

Rotates aGrid in a clockwise motion around the lower-left corner by anAngle.

aGridResTypeEnum defines the type of resampling to be used during the operation if anAngle is not a multiple of 90 degrees. For more information on resampling methods, see the Discussion topic for the aGrid.Resample request.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Rotate (anAngle, aGridResTypeEnum)

Returns

Grid


Shift (Grid)
Shift

Shifts aGrid to newOrigin with a new cell size of aCellSize.

aCellSize can be a Number or Nil. If it is set to Nil, then the original cell size of aGrid is retained.

Syntax

aGrid.Shift (newOrigin, aCellSize)

Returns

Grid


Warp (Grid)
Warp
Discussion	Example

 Applies a polynomial transformation of anOrder to aGrid using links found in aLinkList.

aLinkList is a List of Line objects in which the start point for each Line defines the current x,y coordinates for that point on aGrid, and the end point defines the desired coordinates for the point.

aGridResTypeEnum defines the type of resampling to be used during the operation. For more information on resampling methods, see the Discussion topic for the aGrid.Resample request.

aCellSize defines the cell size for the output Grid. It can be a Number or Nil. If it is set to Nil, then the cell size is set so that the output Grid has approximately the same number of rows and columns as aGrid.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Warp (aLinkList, anOrder, aGridResTypeEnum, aCellSize)

Returns

Grid


Aspect (Grid)
Aspect
Discussion

Calculates aspect for each cell in the surface represented by aGrid.

Syntax

aGrid.Aspect

Returns

Grid


Contour (Grid)
Contour
Discussion

Generates contours from a surface represented by aGrid and saves it as an FTab named aFN.

anInterval defines the contour interval used to create the contours.

baseContour can be a Number or Nil, that defines the base number to start the contour interval from. If baseContour is set to Nil, then the value of 0 is used. Contours are created both above and below the baseContour.

aPrj defines the map projection that aGrid is in if you want the contour lines converted to decimal degrees when they are created. If you want the contour lines to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.Contour (aFN, anInterval, baseContour, aPrj)

Returns

FTab


ContourList (Grid)
ContourList
Discussion

Generates contours from a surface represented by aGrid and saves it as an FTab named aFN.

aList defines the contour intervals at any z values. It is a List of Number objects.

aPrj defines the map projection that aGrid is in if you want the contour lines converted to decimal degrees when they are created. If you want the contour lines to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.ContourList (aFN, aList, aPrj)

Returns

FTab


Curvature (Grid)
Curvature
Discussion

Calculates curvature for each cell in the surface represented by aGrid based on fitting a parametric surface to the neighborhood of that cell. Also creates output grid data sets of profile and plan curvature (proCurvFN and planCurvFN), slope (slopeFN), and aspect (aspectFN).

proCurvFN, planCurvFN, slopeFN, and aspectFN can be a FileName or Nil. If any of them are set to Nil, then that output is not calculated.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

aGrid.Curvature (proCurvFN, planCurvFN, slopeFN, aspectFN)

Returns

Grid


CutFill (Grid)
CutFill

Calculates cut and fill volume between afterGrid and beforeGrid for each contiguous cut or fill area. The Field "VOLUME" is added to the VTab of the output Grid to hold the volume value for each contiguous cut or fill area.

zFactor defines the number of x,y units in one z unit.

Syntax

beforeGrid.CutFill (afterGrid, zFactor)

Returns

Grid


FlowAccumulation (Grid)
FlowAccumulation
Discussion	Example

Calculates the flow accumulation for each cell. aGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

weightGrid can be a Grid or Nil, and represents the weight to assign to each cell. If weightGrid is set to Nil a weight of 1 is used for each cell.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FlowAccumulation (weightGrid)

Returns

Grid


FlowDirection (Grid)
FlowDirection
Discussion	Example

Calculates the flow direction of each cell in the surface represented by aGrid.

If forceEdge is TRUE, then all cells on the edge of the surface will flow away from the surface. If forceEdge is FALSE, then flow is calculated normally for edge cells with the edge being slightly lower than the cell.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FlowDirection (forceEdge)

Returns

Grid


FlowLength (Grid)
FlowLength
Discussion

Calculates the accumulated flow length to each cell. aGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

weightGrid can be a Grid or Nil, that defines the impedance to move through each cell. If weightGrid is set to Nil, then all cells will have an equal impedance.

If upStream is TRUE, then flow length is calculated from each cell to the top of the drainage divide. If upStream is FALSE, then flow length is calculated for each cell to a sink or outlet.

This request is only available with the Spatial Analyst.

Syntax

aGrid.FlowLength (weightGrid, upStream)

Returns

Grid


HillShade (Grid)
HillShade
Discussion

Generates a hill shaded Grid from the surface represented by aGrid.

anAzimuth can be a Number or Nil, that defines the azimuth angle of the light source in degrees. If anAzimuth is set to Nil, then an angle of 315 degrees is used.

anAltitude can be a Number or Nil, that defines the angle of the illumination source above the horizon. If anAltitude is set to Nil, then an angle of 45 degrees is used.

zFactor can be a Number or Nil, and is the number of x,y units in one z unit. If it is set to Nil, then the value of 1 is used.

Syntax

aGrid.HillShade (anAzimuth, anAltitude, zFactor)

Returns

Grid


QueryContour (Grid)
QueryContour
Discussion

 Queries the contour crossing at aPoint.

Returns TRUE if a contour exists at aPoint. It returns FALSE if aPoint is outside the extent of aGrid or is in a flat area. It also returns the zValue of the contour and the contour itself in anArc.

aPrj defines the map projection that aGrid is in if you want the contour line converted to decimal degrees when it is created. If you want the contour line to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.QueryContour (aPoint, zValue, anArc, aPrj)

Returns

Boolean


ReturnContour (Grid)
ReturnContour
Discussion	Example

 Returns the contour crossing at aPoint.

It returns a Nil Shape, if a contour doesn't exist at aPoint. It also returns the zValue of the contour.

aPrj defines the map projection that aGrid is in if you want the contour line converted to decimal degrees when it is created. If you want the contour line to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.ReturnContour (aPoint, zValue, aPrj)

Returns

PolyLine


Sink (Grid)
Sink
Discussion

Creates a Grid identifying all areas of internal drainage. aGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Sink

Returns

Grid


Slope (Grid)
Slope
Discussion

Calculates slope for each cell in the surface represented by aGrid.

zFactor defines the number of x,y units in one z unit. It can be a Number or Nil. If it is set to Nil, then the value of 1 is used.

If percentRise is TRUE, then output slope is calculated as percent rise or percent slope. If percentRise is FALSE, then output slope is calculated in degrees.

Syntax

aGrid.Slope (zFactor, percentRise)

Returns

Grid


SnapPourPoint (Grid)
SnapPourPoint
Discussion	Example

Snaps pour points indicated by values other than No Data in aGrid to new locations, with a maximum value in weightGrid, within a snapDistance.

weightGrid is a Grid of flow accumulation usually created with the aGrid.FlowAccumulation request.

snapDistance defines the maximum distance in map units to search for a cell of higher accumulated flow.

This request is only available with the Spatial Analyst.

Syntax

aGrid.SnapPourPoint (weightGrid, snapDistance)

Returns

Grid


StreamLink (Grid)
StreamLink
Discussion	Example

Assigns unique values to sections of a raster linear network. aGrid is a Grid representing a raster linear network such as streams.

dirGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

This request is only available with the Spatial Analyst.

Syntax

aGrid.StreamLink (dirGrid)

Returns

Grid


StreamOrder (Grid)
StreamOrder
Discussion

Assigns a numeric order to segments of aGrid, which represents branches of a linear network.

dirGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

If shreveMethod is TRUE, then the Shreve stream ordering method is used. If it is FALSE, then the Strahler stream ordering method is used.

This request is only available with the Spatial Analyst.

Syntax

aGrid.StreamOrder (dirGrid, shreveMethod)

Returns

Grid


Visibility (Grid)
Visibility
Discussion	Example

Calculates visibility for each cell of a surface represented by aGrid in relation to the features found in aFTab.

anFTab can be a point or line FTab.

aPrj defines the map projection that features in anFTab should be converted to before being used. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

If cellObserved is TRUE, then the output Grid will contain fields in its VTab for each observer point containing information on whether or not that cell can be seen by each observer. If cellObserved is FALSE, then each cell in the output Grid will contain the number of observers that can see that point.

Syntax

aGrid.Visibility (anFTab, aPrj, cellObserved)

Returns

Grid


Watershed (Grid)
Watershed
Discussion	Example

Determines the contributing area above each set of cells with values other than No Data defined in srcGrid.

dirGrid is a Grid of flow direction usually created with the aGrid.FlowDirection request.

This request is only available with the Spatial Analyst.

Syntax

dirGrid.Watershed (srcGrid)

Returns

Grid


BoundaryClean (Grid)
BoundaryClean

Smoothes the boundary between zones in aGrid by expanding and shrinking the boundary.

aGridSortTypeEnum defines the priority different zones have over each other during the process.

If onceOnly is TRUE, then the expanding and shrinking process is done only once. If it is FALSE, then the process is done twice, with the first one following the priorities set with aGridSortTypeEnum and the second reversing the priorities.

This request is only available with the Spatial Analyst.

Syntax

aGrid.BoundaryClean (aGridSortTypeEnum, onceOnly)

Returns

Grid


Expand (Grid)
Expand

Expands the specified zones of aGrid defined with aZoneValueList by specified number of cells defined by numberCells. aZoneValueList is a List of Number objects.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Expand (numberCells, aZoneValueList)

Returns

Grid


MajorityFilter (Grid)
MajorityFilter

Replaces the value of each cell in aGrid based on the majority value of its contiguous neighboring cells.

If diagNbrs is TRUE, then a neighborhood of the eight nearest cells is used. If it is FALSE, then only the four orthogonal cells are used for the neighborhood.

If halfOk is TRUE, then only half the cells must have the same value to be a majority. If it is FALSE, then a clear majority needs to be obtained.

This request is only available with the Spatial Analyst.

Syntax

aGrid.MajorityFilter (diagNbrs, halfOk)

Returns

Grid


Nibble (Grid)
Nibble

Replaces the cells of aGrid that are No Data in the maskGrid with the values of their nearest neighbors.

If dataOnly is TRUE, then only neighbors with values other than No Data are used. If it is FALSE, then any neighbor can be used regardless of its value.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Nibble (maskGrid, dataOnly)

Returns

Grid


RegionGroup (Grid)
RegionGroup

 Groups each cell of aGrid into a connected region assigning a unique number to each region.

If noDiagNbrs is TRUE, then cells diagonal to each other are not considered connected. Cells must be orthogonal to each other to be connected. Only the 4 orthogonal neighbors to the processing cell are used. If it is FALSE, then cells that are orthogonal or diagonal to each other are considered to be connected. All 8 neighboring cells to the processing cell are used.

If crossClass is TRUE, then all values except the excludedValue are considered the same and can be connected into the same region. crossClass can only be TRUE when a value for excludedValue is given. If crossClass is FALSE, then only cells with the same value can be connected into the same region.

excludedValue can be a Number or Nil, and defines the value of cells to be treated as No Data during the process. If excludedValue is set to Nil, then no value is set to No Data. The value in excludeValue cannot be set to No Data if crossClass is TRUE.

This request is only available with the Spatial Analyst.

Syntax

aGrid.RegionGroup (noDiagNbrs, crossClass, excludedValue)

Returns

Grid


Shrink (Grid)
Shrink

Shrinks the specified zones of aGrid defined with aZoneValueList by specified number of cells defined by numberCells. aZoneValueList is a List of Number objects.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Shrink (numberCells, aZoneValueList)

Returns

Grid


Thin (Grid)
Thin

Thins raster linear features in aGrid.

If notBinary is TRUE, then all values other than No Data are thinned. If it is FALSE, then only values greater than 0 are thinned.

If doFilter is TRUE, then aGrid is filtered to smooth the boundaries between values. If it is FALSE, then no filter is applied.

If sharpenCorners is TRUE, then rectangular corners and junctions are preserved. If it is FALSE, then all corners and junctions are smoothed.

maxThickness can be a Number or Nil, that defines the maximum thickness, in map units, of linear features in aGrid. If maxThickness is set to Nil a value 10 times the cell size of aGrid is used.

This request is only available with the Spatial Analyst.

Syntax

aGrid.Thin (notBinary, doFilter, sharpenCorners, maxThickness)

Returns

Grid


CostDistance (Grid)
CostDistance
Discussion

 Calculates for each cell the least-accumulative-cost distance over a cost surface, costGrid, to cells with values other than No Data in aGrid, optionally producing direction and allocation grid data sets (directionFN and allocationFN).

directionFN can be a FileName or Nil, and defines the FileName for the optional cost direction grid data set. allocationFN can be a FileName or Nil, and defines the FileName for the optional cost allocation grid data set. If either directionFN or allocationFN is set to Nil the optional output grid data set for the argument that is set to Nil is not calculated.

maxDistance can be a Number or Nil, and defines the threshold that the accumulative cost values cannot exceed. If a cell exceeds the value it is given the value of No Data. If maxDistance is set to Nil, then the value of infinity is used.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid.CostDistance (costGrid, directionFN, allocationFN, maxDistance)

Returns

Grid


CostPath (Grid)
CostPath
Discussion

 Calculates the shortest cost paths from a set of cells with values other than No Data in aGrid.

distanceGrid and directionGrid are distance and direction Grids for the cells with values other than No Data in aGrid, and are produced with the aGrid.CostDistance request.

If byZone is TRUE, then a single least-cost path is calculated for each set of cells with the same value. If it is FALSE, then a path for each cell with a value other than No Data in aGrid is calculated.

This request is only available with the Spatial Analyst.

Syntax

aGrid.CostPath (distanceGrid, directionGrid, byZone)

Returns

Grid


EucAllocation (Grid)
EucAllocation
Discussion

 Calculates for each cell its allocation to the closest cell with a value other than No Data in aGrid, optionally producing distance and direction grid data sets (distanceFN and directionFN).

distanceFN can be a FileName or Nil, and defines the FileName for the optional Euclidean distance grid data set. directionFN can be a FileName or Nil, and defines the FileName for the optional Euclidean direction grid data set. If either distanceFN or directionFN is set to Nil, then the optional output grid data set that is set to Nil is not calculated.

maxDistance can be a Number or Nil, and defines the maximum distance that can be used to allocate a cell to a source. If a cell is farther than maxDistance to the closest cell with a value other than No Data in aGrid, then it is given the value of No Data. If maxDistance is set to Nil, then the value of infinity is used.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid.EucAllocation (distanceFN, directionFN, maxDistance)

Returns

Grid


EucDistance (Grid)
EucDistance
Discussion

 Calculates for each cell the Euclidean distance to the closest cell that has a value other than No Data in aGrid, optionally producing direction and allocation grid data sets (directionFN and allocationFN).

directionFN can be a FileName or Nil, and defines the FileName for the optional Euclidean direction grid data set. allocationFN can be a FileName or Nil, and defines the FileName for the optional Euclidean allocation grid data set. If either directionFN or allocationFN is set to Nil, then the optional output grid data set that is set to Nil is not calculated.

maxDistance can be a Number or Nil, and defines the maximum distance that can be calculated. If a cell is farther than maxDistance to the closest cell with a value other than No Data in aGrid, then it is given the value of No Data. If maxDistance is set to Nil, then the value of infinity is used.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

This request is only available with the Spatial Analyst.

Syntax

aGrid.EucDistance (directionFN, allocationFN, maxDistance)

Returns

Grid


ReturnCostPath (Grid)
ReturnCostPath
Discussion	Example

 Returns the cost path from aPoint to the nearest source cell on the cost distance Grid, aGrid. directionGrid is a backlink Grid giving directions on how to travel the lowest cost path.

Syntax

aGrid.ReturnCostPath (directionGrid, aPoint)

Returns

PolyLine


AsPointFTab (Grid)
AsPointFTab

Converts aGrid to a point FTab named aFileName. If there is a selection on aGrid, then only selected cells are converted, otherwise, all cells are converted.

aPrj defines the map projection that aGrid is in if you want the points converted to decimal degrees when they are created. If you want the points to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.AsPointFTab (aFileName, aPrj)

Returns

FTab


AsPolygonFTab (Grid)
AsPolygonFTab
Example

Converts aGrid to a polygon FTab named aFileName. If there is a selection on aGrid, then only selected cells are converted, otherwise, all cells are converted.

If performWeeding is TRUE, then a generalization algorithm tailored for raster to vector conversion is applied. If it is FALSE, then no weeding is done.

aPrj defines the map projection that aGrid is in if you want the polygons converted to decimal degrees when they are created. If you want the polygons to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.AsPolygonFTab (aFileName, performWeeding, aPrj)

Returns

FTab


AsPolyLineFTab (Grid)
AsPolyLineFTab

 Converts aGrid to a polyline FTab named aFileName. If there is a selection on aGrid, then only selected cells are converted, otherwise, all cells are converted. aGrid is assumed to contain thin raster lines. The request aGrid.Thin can be used to thin the raster lines before using this request.

If notBinary is TRUE, then all values other than No Data are considered raster lines. If it is FALSE, then only values greater than 0 are considered raster lines.

If performWeeding is TRUE, then a generalization algorithm tailored for raster to vector conversion is applied. If it is FALSE, then no weeding is done. The generalization algorithm uses the Douglas-Poiker algorithm with a tolerance of: sqrt(0.5) * cellsize.

aPrj defines the map projection that aGrid is in if you want the polylines converted to decimal degrees when they are created. If you want the polylines to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.AsPolyLineFTab (aFileName, notBinary, performWeeding, aPrj)

Returns

FTab


StreamToPolyLineFTab (Grid)
StreamToPolyLineFTab

 Converts the linear raster network in aGrid to a polyline FTab named aFileName.

dirGrid contains the flow directions in each cell to assist conversion, and can be created using aGrid.FlowDirection.

The selection on aGrid and dirGrid is ignored.

If performWeeding is TRUE, then a generalization algorithm tailored for raster to vector conversion is applied. If it is FALSE, then no weeding is done. The generalization algorithm uses the Douglas-Poiker algorithm with a tolerance of: sqrt(0.5) * cellsize.

aPrj defines the map projection that aGrid is in if you want the polylines converted to decimal degrees when they are created. If you want the polylines to remain in the same map projection as aGrid, then Prj.MakeNull can be used to create a null map projection.

Syntax

aGrid.StreamToPolyLineFTab (aFileName, dirGrid, performWeeding, aPrj)

Returns

FTab


GridEnvTypeEnum

 All spatial analysis takes place within an environment that is defined by an extent rectangle, a cell size and a raster mask. The default analysis environment corresponds to the maximum extent of the input Grids, the maximum (coarsest) cell size of the input Grids and no mask. Clients can control the environment using the Grid.SetAnalysisExtent, Grid.SetAnalysisCellSize and Grid.SetAnalysisMask requests. The Grid.SetAnalysisExtent and Grid.SetAnalysisCellSize requests take the following enumerated types as a parameter:

#GRID_ENVTYPE_MINOF

Sets the analysis cell size or extent to the minimum of all input Grids.

#GRID_ENVTYPE_MAXOF

Sets the analysis cell size or extent to the maximum of all input Grids.

#GRID_ENVTYPE_VALUE

Sets the analysis cell size or extent to a given value.


GridResTypeEnum

 Defines how Grids are resampled. Certain requests need to explicitly resample data using a specified resampling method. Examples include requests to perform polynomial warping. The following enumeration lists the types of resampling methods:

#GRID_RESTYPE_NEAREST

Nearest neighbor

#GRID_RESTYPE_BILINEAR

Bilinear interpolation

#GRID_RESTYPE_CUBIC

Cubic convolution


GridStaTypeEnum

 Defines the type of statistic desired during certain analysis requests on Grids. You are able to calculate statistics at the local, focal, block, and zonal level on a Grid. For more information on local, focal, block, and zonal levels of analysis, see the Discussion topic for the Grid class. The following enumeration lists the types of statistics that can be used :

#GRID_STATYPE_MAJORITY

Majority

#GRID_STATYPE_MAX

Maximum

#GRID_STATYPE_MEAN

Mean

#GRID_STATYPE_MEDIAN

Median

#GRID_STATYPE_MIN

Minimum

#GRID_STATYPE_MINORITY

Minority

#GRID_STATYPE_RANGE

Range

#GRID_STATYPE_STD

Standard deviation

#GRID_STATYPE_SUM

Sum

#GRID_STATYPE_VARIETY

Variety or number of unique occurrences


GridGeomDescEnum

 Defines the types of geometric descriptors that may be computed for the zones in a Grid using the aGrid.ZonalGeometry request. The following enumeration lists the types of descriptors that can be used:

#GRID_GEOMDESC_AREA

Area of a zone

#GRID_GEOMDESC_PERIMETER

Perimeter of a zone

#GRID_GEOMDESC_THICKNESS

Thickness of a zone

#GRID_GEOMDESC_CENTROID

Characteristics of an ellipse that is fit to a zone


GridSortTypeEnum

 Defines the type of sorting that can be performed. This determines the priority of cells to expand into their neighbors when using the aGrid.BoundaryClean request. The following enumeration list the types of sorting that can be used:

#GRID_SORTTYPE_NOSORT

No sorting by size. Zones with larger values have a higher priority to expand into zones with smaller values

#GRID_SORTTYPE_DESCEND

Sorts zones in descending order by size. Zones with smaller total area have a higher priority to expand into zones with larger total area

#GRID_SORTTYPE_ASCEND

Sort zones in ascending order by size. Zones with larger total area have a higher priority to expand into zones with smaller total area


GridVerifyEnum

 Defines whether or not a grid data set can be overwritten. When the Spatial Analyst extension tries to create a new output grid data set and a grid data set with the same name exists, an error message is given, verification is asked for, or the existing grid data set is overwritten, based on the current verification setting. The following enumeration lists the types of verifications:

#GRID_VERIFY_ON

Asks for verification and overwrites the existing grid data set on a YES answer

#GRID_VERIFY_OFF

Always overwrite the existing grid data set

#GRID_VERIFY_ERROR

Give an error message and do not overwrite the existing grid data set


GridFilterTypeEnum

 Defines the type of filters that can be used with the aGrid.Filter request. The following enumerations list the types of filtering that can be done:

#GRID_FILTERTYPE_LOW

Low pass filter using a focal mean with a 3 by 3 kernel.

#GRID_FILTERTYPE_HIGH

High pass filter using a focal sum with the following 3 by 3 kernel:

             -0.7  -1.0  -0.7
             -1.0   6.8  -1.0
             -0.7  -1.0  -0.7


GridSliceTypeEnum

 Defines the type of slicing that can be used with the aGrid.Slice request. The following enumeration list the types of slicing that can be done:

#GRID_SLICETYPE_EQINTERVAL

Break into equal interval ranges

#GRID_SLICETYPE_EQAREA

Break into ranges of equal area


GridDensTypeEnum

 Density surface mapping supports the following mapping types:

#GRID_DENSTYPE_SIMPLE

Simple density

#GRID_DENSTYPE_KERNEL

Kernel density


GTheme
Discussion

 A GTheme is a visual representation of the cell based raster data from an ARC/INFO grid data source. A GTheme is associated with a Grid object. The Grid object for a GTheme may have an associated VTab object if the the underlying grid data source has a Value Attribute Table. The VTab object, if present, is directly accessible as an attribute of the GTheme.

Some GTheme requests are only available with the Spatial Analyst. If a request is only available with the Spatial Analyst it will be noted with the help for that request.

Attributes

Grid. The Grid object represents the data source associated with the GTheme

VTab.The VTab is the Value Attribute Table associated with the underlying grid data source and may or may not be present.

Inherits From

Theme

Class Requests

Making GThemes

GetQueryColor  :  Color

Make ( aGrid ) :  GTheme

MakeCalculationMap ( aView, aName )

MakeQueryMap ( aView, aName )

SetQueryColor ( aColor )

Instance Requests

Checking Capabilities of a GTheme

CanEdit  :  Boolean

CanExportToFTab  :  Boolean

CanLabel  :  Boolean

CanSelect  :  Boolean

HasTable  :  Boolean

Displaying Dialog Boxes

BuildQuery

EditExpression

EditLegend

EditTable

HasExpression  :  Boolean

Supporting Identify

ClearSelection

FindByPoint ( aPoint ) :  List

Identify ( aKeyValue, aString )

QueryValStr ( aFieldName, aPoint, aString ) :  Boolean

Querying a GTheme

ReturnCellValue ( aPoint ) :  Number

Generic Object Requests

Clone  :  GTheme

SetName ( aName )

Getting and Setting Attributes

ExportToFTab ( anFileName ) :  FTab

GetGrid  :  Grid

GetVTab  :  VTab

ReturnExtent  :  Rect

Refreshing and Updating a GTheme

UpdateLegend

Creating Histograms of a GTheme

Histogram ( useLegend, aField, useGraphics ) :  Chart

ZoneHistogram ( useLegend, aField, zoneTheme, zoneField ) :  Chart

__________

See also

Legend
View
Grid
VTab
SrcName


GetQueryColor (GTheme)
GetQueryColor

Gets the color that is used to display cells with a value of 1 (TRUE) in the Legends for GThemes created with the GTheme.MakeQueryMap request.

This request is only available with the Spatial Analyst.

Syntax

GTheme.GetQueryColor

Returns

Color


Make (GTheme)
Make

Makes a GTheme from aGrid.

This request will trigger the evaluation of aGrid, if aGrid has not yet been evaluated. For more information on the evaluation of Grid objects, see the Discussion topic for the Grid class.

Syntax

GTheme.Make (aGrid)

Returns

GTheme


MakeCalculationMap (GTheme)
MakeCalculationMap

Makes a new GTheme named aName by allowing the user to define a calculation expression in a dialog, that is based on the grid map layers in aView.

This request is only available with the Spatial Analyst.

Syntax

GTheme.MakeCalculationMap (aView, aName)


MakeQueryMap (GTheme)
MakeQueryMap

Makes a new GTheme named aName by allowing the user to define a Boolean overlay query in a dialog, that is based on the grid map layers in aView.

This request is only available with the Spatial Analyst.

Syntax

GTheme.MakeQueryMap (aView, aName)


SetQueryColor (GTheme)
SetQueryColor

Sets the color that is used to display cells with a value of 1 (TRUE) in the Legends for GThemes created with the GTheme.MakeQueryMap request to aColor.

This request is only available with the Spatial Analyst.

Syntax

GTheme.SetQueryColor (aColor)


CanEdit (GTheme)
CanEdit

Returns TRUE if aGTheme can be edited, otherwise returns FALSE.

Syntax

aGTheme.CanEdit

Returns

Boolean


CanExportToFTab (GTheme)
CanExportToFTab

Returns TRUE if aGTheme's cells can be exported to an FTab.

Syntax

aGTheme.CanExportToFTab

Returns

Boolean


CanLabel (GTheme)
CanLabel

Returns FALSE because aGTheme's cells cannot be labeled.

Syntax

aGTheme.CanLabel

Returns

Boolean


CanSelect (GTheme)
CanSelect

Returns FALSE because aGTheme's cells cannot be spatially selected.

Syntax

aGTheme.CanSelect

Returns

Boolean


HasTable (GTheme)
HasTable

Returns TRUE if aGTheme has an associated Table.

Syntax

aGTheme.HasTable

Returns

Boolean


BuildQuery (GTheme)
BuildQuery

Displays the Query Builder dialog for aGTheme. The Query Builder allows you to build an attribute query and executes it on the VTab of aGTheme. You should check that aGTheme has a VTab with the aGTheme.HasTable request before using this request.

Syntax

aGTheme.BuildQuery


EditExpression (GTheme)
EditExpression
Example

Displays the dialog for the expression of aGTheme. This dialog will be either the Map Query or Map Calculator dialog depending on how aGTheme was created. The request aGTheme.HasExpression should be used to check that aGTheme has an expression before using this request.

This request is only available with the Spatial Analyst.

Syntax

aGTheme.EditExpression


EditLegend (GTheme)
EditLegend

Opens the Legend Editor for aGTheme.

Syntax

aGTheme.EditLegend


EditTable (GTheme)
EditTable

Opens a Table showing the VTab of aGTheme. You should check that aGTheme has a VTab with the aGTheme.HasTable request before using this request.

Syntax

aGTheme.EditTable


HasExpression (GTheme)
HasExpression
Example

Returns TRUE if aGTheme was created with the GTheme.MakeQueryMap or GTheme.MakeCalculationMap requests.

This request is only available with the Spatial Analyst.

Syntax

aGTheme.HasExpression

Returns

Boolean


ClearSelection (GTheme)
ClearSelection

Clears the selection on a GTheme.

Syntax

aGTheme.ClearSelection


FindByPoint (GTheme)
FindByPoint

Finds the cells identified by aPoint in aGTheme.

Returns an empty List if no cells are found. If it finds cells, it returns a List containing the key for the "found cell". The key is the query point itself.

Syntax

aGTheme.FindByPoint (aPoint)

Returns

List


Identify (GTheme)
Identify

Puts information from aGTheme at aKeyValue (a Point) into the Identify window labeled by aString.

Syntax

aGTheme.Identify (aKeyValue, aString)


QueryValStr (GTheme)
QueryValStr

Queries the value of a Field with aFieldName using the key aPoint as a String into aString.

Syntax

aGTheme.QueryValStr (aFieldName, aPoint, aString)

Returns

Boolean


ReturnCellValue (GTheme)
ReturnCellValue

Returns the value of the cell containing aPoint in aGTheme.

Syntax

aGTheme.ReturnCellValue (aPoint)

Returns

Number


Clone (GTheme)
Clone

Clones aGTheme.

Syntax

aGTheme.Clone

Returns

GTheme


SetName (GTheme)
SetName

Sets the name of aGTheme to aName.

Syntax

aGTheme.SetName (aName)


ExportToFTab (GTheme)
ExportToFTab

Exports aGTheme to a polygon FTab, stored in aFileName, by performing raster to vector conversion. If there is a selection, then only the selected cells are exported, otherwise, all are exported. Output lines will be generalized with an algorithm tailored for raster to vector conversion. If generalization is not desired, then use the aGrid.AsPolygonFTab request with performWeeding set to FALSE. The request aGTheme.CanExportToFTab should be used to check if aGTheme can be exported before this request is used.

Syntax

aGTheme.ExportToFTab (anFileName)

Returns

FTab


GetGrid (GTheme)
GetGrid
Example

Gets aGTheme's Grid.

Syntax

aGTheme.GetGrid

Returns

Grid


GetVTab (GTheme)
GetVTab

Gets aGTheme's VTab. The request aGTheme.HasTable should be used to check that aGTheme has a VTab before using this request.

Syntax

aGTheme.GetVTab

Returns

VTab


ReturnExtent (GTheme)
ReturnExtent

Returns the extent of aGTheme.

Syntax

aGTheme.ReturnExtent

Returns

Rect


UpdateLegend (GTheme)
UpdateLegend

Updates aGTheme to reflect changes to its Legend. UpdateLegend invalidates both the GTheme and its Legend.

Syntax

aGTheme.UpdateLegend


Histogram (GTheme)
Histogram
Example

Creates a Chart to show the histogram of aField of aGTheme.

If useLegend is TRUE, the Legend of aGTheme is used to group cell values of aGTheme and symbolize the bars of the Chart. aField is ignored if useLegend is TRUE. If useLegend is TRUE and the number of classes in the Legend is less than 2, then the Legend is not used to group cell values.

aField specifies what Field in aGTheme's VTab is used to give cells their value. It can be a Field in aGTheme's VTab or Nil. If Nil is used, then the Value Field is used.

If useGraphics is TRUE, then the selected Graphics of the View are used to restrict the spatial area that is used to create the histogram. Only cells that are contain within or intersected by the selected Graphics are used to create the histogram.

This request is only available with the Spatial Analyst.

Syntax

aGTheme.Histogram (useLegend, aField, useGraphics)

Returns

Chart


ZoneHistogram (GTheme)
ZoneHistogram
Example

 Creates a Chart showing a set of histograms for aField of a GTheme. A separate histogram is generated for each unique value in the zoneField.

zoneTheme's features are used to specify which cells in aGTheme are used to create the histograms. It can be either a GTheme or FTheme. Cells that intersect or are contained within features of zoneTheme create a separate histogram for each unique value in the zoneField. If there is a selection on the zoneTheme, then only selected features are used to specify cells, otherwise, all features are used.

If useLegend is TRUE, the Legend of aGTheme is used to group cell values of aGTheme and symbolize the bars of each histogram in the Chart. aField is ignored if useLegend is TRUE. If useLegend is TRUE and the number of classes in the Legend is less than 2, then the Legend is not used to group cell values.

aField specifies what Field in aGTheme's VTab is used to give cells their value. It can be a Field in aGTheme's VTab or Nil. If Nil is used, then the Value Field is used.

This request is only available with the Spatial Analyst.

Syntax

aGTheme.ZoneHistogram (useLegend, aField, zoneTheme, zoneField)

Returns

Chart


Interp

 An Interp is a Grid Interpolator which provides a complete description of how a grid should be interpolated from a point FTab.

Inherits From

Obj

Enumerations

SplineEnum

Class Requests

Interp

Make  :  Interp

MakeFromVariogram ( aSVGram, aRadius, aBarrierFTab, outVarGridFN ) :  Interp

MakeIDW ( aPower, aRadius, aBarrierFTab ) :  Interp

MakeKriging ( aType, aRadius, aBarrierFTab, outVarGridFN ) :  Interp

MakeSpline ( aType, aWeight, numberPoints ) :  Interp

MakeTrend ( anOrder, useLogistic ) :  Interp

__________

See also

Grid
Radius


Make (Interp)
Make

Makes a default interpolator which is Inverse Distance Weighted (IDW) with a power of 2, no barriers, and a variable Radius of 12 points with no maximum distance.

Syntax

Interp.Make

Returns

Interp


MakeFromVariogram (Interp)
MakeFromVariogram
Discussion	Example

 Makes a Kriging interpolator from a semi-variogram.

aRadius controls how searching for input points is done. It can be a Radius or Nil. If it is Nil, then a variable Radius of 12 points with no maximum distance is used.

aBarrierFTab is used as a limit within the Radius to control searching for input points across such features as ridge lines. It can be a line FTab or Nil. If it is Nil, then no limit is used within the Radius when searching for input points.

outVarGridFN is the FileName of the optional output grid data set of predicted semi-variance values for each cell in the Grid created when this Interp object is passed to the Grid.MakeByInterpolation or anFTab.Interpolate requests. outVarGridFN can be a FileName or Nil. If it is Nil, then a grid data set isn't created.

Syntax

Interp.MakeFromVariogram (aSVGram, aRadius, aBarrierFTab, outVarGridFN)

Returns

Interp


MakeIDW (Interp)
MakeIDW
Discussion	Example

Makes an Inverse Distance Weighted (IDW) interpolator.

aPower is the exponent of distance that controls the significance of surrounding points upon the interpolated value.

aRadius controls how searching for input points is done. It can be a Radius or Nil. If it is Nil, then a variable Radius of 12 points with no maximum distance is used.

aBarrierFTab is used as a limit within the Radius to control searching for input points across such features as ridge lines. It can be a line FTab or Nil. If it is Nil, then no limit is used within the Radius when searching for input points.

Syntax

Interp.MakeIDW (aPower, aRadius, aBarrierFTab)

Returns

Interp


MakeKriging (Interp)
MakeKriging
Discussion	Example

Makes a Kriging interpolator.

aType is the type of mathematical function used to model the semi-variance.

aRadius controls how searching for input points is done. It can be a Radius or Nil. If it is Nil, then a variable Radius of 12 points with no maximum distance is used.

aBarrierFTab is used as a limit within the Radius to control searching for input points across such features as ridge lines. It can be a line FTab or Nil. If it is Nil, then no limit is used within the Radius when searching for input points.

outVarGridFN is the FileName of the optional output grid data set of predicted semi-variance values for each cell in the Grid created when this Interp object is passed to the Grid.MakeByInterpolation or anFTab.Interpolate requests. outVarGridFN can be a FileName or Nil. If it is Nil, then a grid data set isn't created.

Syntax

Interp.MakeKriging (aType, aRadius, aBarrierFTab, outVarGridFN)

Returns

Interp


MakeSpline (Interp)
MakeSpline
Discussion	Example

Makes a Spline interpolator of aType.

aWeight influences the character of the surface. With aType of #SPLINE_REGULARIZED it defines the weight of the third derivatives of the surface in the curvature minimization expression. With aType of #SPLINE_TENSION it defines the weight of the tension. aWeight can be a Number or Nil. If it is Nil, then a weight of 0.1 is used.

numberPoints is the number of points per region that is used for local approximation. It can be a Number or Nil. If it is Nil, then 12 points are used.

Syntax

Interp.MakeSpline (aType, aWeight, numberPoints)

Returns

Interp


MakeTrend (Interp)
MakeTrend
Discussion	Example

Makes a Trend Surface interpolator.

anOrder defines the order of polynomial that is used to create the surface.

If useLogistic is TRUE, then a logistic trend surface analysis is performed, generating a continuous probability surface for binary, or dichotomous, types of data. If useLogistic is FALSE, then a polynomial regression is performed to fit a least-squares surface to the set of input points. This is more suited for continuous types of data.

Syntax

Interp.MakeTrend (anOrder, useLogistic)

Returns

Interp


SplineEnum

 The Spline Interpolator supports the following spline types:

#SPLINE_TENSION

Spline with Tension

#SPLINE_REGULARIZED

Regularized Spline


InterpolationDialog

 This class provides a dialog for specifying parameters for the Grid.MakeByInterpolation and anFTab.Interpolate requests.

Inherits From

ModalDialog

Class Requests

InterpolationDialog

Show ( aPointFTheme, aCellSize ) :  List

__________

See also

Grid
Interp
Radius


Show (InterpolationDialog)
Show
Example

 Shows the Interpolate Surface dialog.

aPointFTheme should be a point or mult-point FTheme with at least one numeric Field.

aCellSize specifies the cell size for the output Grid created with the objects on the returned List with the aGrid.MakeByInterpolation or anFTab.Interpolate requests. It is used to supply the default for the Fixed Radius parameter for an IDW interpolation in the dialog.

Returns a List of the following:

      0: a Field (Field)
      1: an Interpolator (Interp)

Syntax

InterpolationDialog.Show (aPointFTheme, aCellSize)

Returns

List


NbrHood

 A NbrHood is a specification of a neighborhood and is used to specify the cells involved with the aGrid.FocalStats or aGrid.BlockStats requests.

A NbrHood can also be used to specify the points involved with the Grid.MakeFromPointStats or anFTab.FocalStats requests.

This class and it's request are only available with the Spatial Analyst.

Inherits From

Obj

Class Requests

NbrHood

Make  :  NbrHood

MakeAnnulus ( innerRadius, outerRadius, inMapUnits ) :  NbrHood

MakeCircle ( aRadius, inMapUnits ) :  NbrHood

MakeIrregular ( aList ) :  NbrHood

MakeRectangle ( aWidth, aHeight, inMapUnits ) :  NbrHood

MakeWedge ( aRadius, startAngle, endAngle, inMapUnits ) :  NbrHood

__________

See also

Grid


Make (NbrHood)
Make

Makes a default 3 cell x 3 cell rectangular neighborhood.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.Make

Returns

NbrHood


MakeAnnulus (NbrHood)
MakeAnnulus

 Makes an annulus, or donut, neighborhood with the specified innerRadius and outerRadius.

If inMapUnits is TRUE, then the radii values are in map units. If inMapUnits is FALSE, then the radii values are in number of cells.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.MakeAnnulus (innerRadius, outerRadius, inMapUnits)

Returns

NbrHood


MakeCircle (NbrHood)
MakeCircle

 Makes a circular neighborhood with the specified aRadius.

If inMapUnits is TRUE, then the radius value is in map units. If inMapUnits is FALSE, then the radius value is in number of cells.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.MakeCircle (aRadius, inMapUnits)

Returns

NbrHood


MakeIrregular (NbrHood)
MakeIrregular
Discussion	Example

Makes an irregular neighborhood using aList

aList is a List of Lists of Numbers. The Lists represents membership in the neighborhood for each cell in a n x n kernel. The values in the Lists should be 0 or 1. The value of 1 includes the cell in the neighborhood, while the value of 0 does not. Each row in the kernel is a List, there are n Lists, each with n Numbers.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.MakeIrregular (aList)

Returns

NbrHood


MakeRectangle (NbrHood)
MakeRectangle

 Makes a rectangular neighborhood with the specified aWidth and aHeight.

If inMapUnits is TRUE, then the width and height values are in map units. If inMapUnits is FALSE, then the width and height values are in number of cells.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.MakeRectangle (aWidth, aHeight, inMapUnits)

Returns

NbrHood


MakeWedge (NbrHood)
MakeWedge

 Makes a wedge neighborhood with the specified aRadius, startAngle, and endAngle.

If inMapUnits is TRUE, then the radius value is in map units. If inMapUnits is FALSE, then the radius value is in number of cells. Angles are always in degrees.

This request is only available with the Spatial Analyst.

Syntax

NbrHood.MakeWedge (aRadius, startAngle, endAngle, inMapUnits)

Returns

NbrHood


Radius

 A Radius defines the search radius for those interpolators that are based on a local moving average, such as IDW and Kriging. The search radius can be fixed or variable.

A fixed search radius has a fixed circular search distance and a minimum sample count. Local averaging is limited to samples within the fixed search radius unless the number of samples within the radius is less than the minimum sample requirement. In that case, the radius is expanded to include the minimum number of samples.

A variable search radius has a fixed number of samples and a maximum search distance. The variable search radius finds the closest samples within the maximum search distance until the specified number of samples is achieved. If the specified number of samples does not exist within the maximum search distance, then only those samples found are used.

Inherits From

Obj

Class Requests

Radius

Make  :  Radius

MakeFixed ( aDistance, aCount ) :  Radius

MakeVariable ( aCount, aDistance ) :  Radius

__________

See also

Grid
Interp


Make (Radius)
Make

Makes a variable Radius with a count of 12 and no maximum search distance.

Syntax

Radius.Make

Returns

Radius


MakeFixed (Radius)
MakeFixed

Makes a fixed Radius with a fixed search distance and minimum sample count.

aCount can be a Number or Nil. If it is Nil, then a minimum sample count of 0 is used.

Syntax

Radius.MakeFixed (aDistance, aCount)

Returns

Radius


MakeVariable (Radius)
MakeVariable

Makes a variable Radius with a fixed sample count and a maximum search distance.

aDistance can be a Number or Nil. If it is Nil, then there will be no maximum search distance.

Syntax

Radius.MakeVariable (aCount, aDistance)

Returns

Radius


ReclassEditor

 This class provides a dialog for specifying reclassification parameters for the aGrid.ReclassByClassList request.

This class and it's requests are only available with the Spatial Analyst.

Inherits From

ModalDialog

Class Requests

ReclassEditor

Show ( aTheme ) :  List

__________

See also

Grid
Classification


Show (ReclassEditor)
Show
Example

Shows the Reclassify Values dialog for aTheme. For use with the aGrid.ReclassByClassList request, aTheme should be a GTheme.

Returns a List of the following:

      0: Field name (String)
      1: List of Classification objects (List)

This request is only available with the Spatial Analyst.

Syntax

ReclassEditor.Show (aTheme)

Returns

List


AnalysisEnvironment
Example

 Instances of class AnalysisEnvironment are used to store the analysis environment for the Spatial Analyst extension. Each View is associated with an AnalysisEnvironment object that specifies the analysis extent, cell size, and mask GTheme to use when performing analysis with the Spatial Analyst extension in that View.

Inherits From

DocumentExtension

Enumerations

AnalysisEnvEnum

Instance Requests

AnalysisEnvironment

Activate

GetCellSize ( aCellSize ) :  AnalysisEnvEnum

GetExtent ( aRect ) :  AnalysisEnvEnum

GetMask  :  GTheme

SetCellSize ( anAnalysisEnvEnum, aCellSize )

SetExtent ( anAnalysisEnvEnum, aRect )

SetMask ( aGTheme )

Object Management

Store  :  Boolean

__________

See also

Doc
View
Grid


Activate (AnalysisEnvironment)
Activate

 Makes anAnalysisEnvironment the active environment for the Spatial Analyst extension.

Syntax

anAnalysisEnvironment.Activate


GetCellSize (AnalysisEnvironment)
GetCellSize

Gets the analysis environment cell size.

Returns an AnalysisEnvEnum indicating the type of cell size set. If the AnalysisEnvEnum returned is #ANALYSISENV_VALUE, then aCellSize is set to the analysis environment cell size.

Syntax

anAnalysisEnvironment.GetCellSize (aCellSize)

Returns

AnalysisEnvEnum


GetExtent (AnalysisEnvironment)
GetExtent

Gets the analysis environment extent.

Returns an AnalysisEnvEnum indicating the type of extent set. If the AnalysisEnvEnum returned is #ANALYSISENV_VALUE, then aRect is set to the analysis environment extent.

Syntax

anAnalysisEnvironment.GetExtent (aRect)

Returns

AnalysisEnvEnum


GetMask (AnalysisEnvironment)
GetMask

Gets the analysis environment mask. If a mask is not set it will return NIL.

Syntax

anAnalysisEnvironment.GetMask

Returns

GTheme


SetCellSize (AnalysisEnvironment)
SetCellSize

 Sets the analysis environment cell size to aCellSize.

If anAnalysisEnvEnum is #ANALYSISENV_VALUE, then aCellSize should be a Number. If anAnalysisEnvEnum is #ANALYSISENV_MAXOF or #ANALYSISENV_MINOF, then aCellSize should be Nil.

Syntax

anAnalysisEnvironment.SetCellSize (anAnalysisEnvEnum, aCellSize)


SetExtent (AnalysisEnvironment)
SetExtent

 Sets the analysis environment extent to aRect.

If anAnalysisEnvEnum is #ANALYSISENV_VALUE, then aRect should be a Rect. If anAnalysisEnvEnum is #ANALYSISENV_MAXOF or #ANALYSISENV_MINOF, then aRect should be Nil.

Syntax

anAnalysisEnvironment.SetExtent (anAnalysisEnvEnum, aRect)


SetMask (AnalysisEnvironment)
SetMask

Sets the analysis environment mask to aGTheme.

Syntax

anAnalysisEnvironment.SetMask (aGTheme)


Store (AnalysisEnvironment)
Store

Returns TRUE if the object is to be stored.

Syntax

anAnalysisEnvironment.Store

Returns

Boolean


AnalysisEnvEnum

 All spatial analysis takes place within an environment that is defined by an extent rectangle, a cell size and a raster mask. The default analysis environment corresponds to the maximum extent of the input Grids, the maximum (coarsest) cell size of the input Grids and no mask. Clients can control the environment using the anAnalysisEnvironment.SetExtent, anAnalysisEnvironment.SetCellSize and anAnalysisEnvironment.SetMask requests. The anAnalysisEnvironment.SetExtent and anAnalysisEnvironment.SetCellSize requests take the following enumerated types as a parameter :

#ANALYSISENV_MINOF

Sets the analysis cell size or extent to the minimum of all input Grids.

#ANALYSISENV_MAXOF

Sets the analysis cell size or extent to the maximum of all input Grids.

#ANALYSISENV_VALUE

Sets the analysis cell size or extent to a given value.


AnalysisPropertiesDialog

 This class provides a dialog for specifying an AnalysisEnvironment. The user may set the analysis extent, analysis cell size and analysis mask using this dialog.

Inherits From

ModalDialog

Class Requests

AnalysisPropertiesDialog

Show ( aView, forConversion, aTitle ) :  AnalysisEnvironment

__________

See also

View
Grid


Show (AnalysisPropertiesDialog)
Show
Example

 Shows a dialog to specify an AnalysisEnvironment.

If forConversion is FALSE, the dialog loads and allows the user to edit the AnalysisEnvironment associated with aView. If forConversion is TRUE, then a new AnalysisEnvironment is returned that may be used to specify the cell size and extent for conversion.

Syntax

AnalysisPropertiesDialog.Show (aView, forConversion, aTitle)

Returns

AnalysisEnvironment


SVGram

 SVGram is the abstraction of the semi-variogram used with Kriging interpolation. It is represented as a VTab with a underlying INFO table. It can be used to create a surface Grid along with the Interp.MakeFromVariogram and Grid.MakeByInterpolation requests.

Inherits From

Obj

Enumerations

KrigingEnum

Class Requests

SVGram

Make ( ptFTab, aPrj, zField, aType, anInterval ) :  SVGram

Instance Requests

Querying SVGram

GetVTab  :  VTab

__________

See also

Grid
Interp


Make (SVGram)
Make
Example

Makes a semi-variogram from ptFTab.

ptFTab should be a point or mult-point FTab with at least one numeric Field.

aPrj is a Prj that defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aType is the type of mathematical function used to model semi-variance. Do not use aType of #KRIGING_UNIVERSAL1 or #KRIGING_UNIVERSAL2. If you wish to use these two types of Kriging, then use the Interp.MakeKriging request.

anInterval is the distance interval used to calculate the semi-variogram.

Syntax

SVGram.Make (ptFTab, aPrj, zField, aType, anInterval)

Returns

SVGram


GetVTab (SVGram)
GetVTab

Gets the VTab associated with a SVGram.

Syntax

anSVGram.GetVTab

Returns

VTab


KrigingEnum

 Kriging supports the following semi-variogram models:

#KRIGING_SPHERICAL

Spherical

#KRIGING_CIRCULAR

Circular

#KRIGING_EXPONENTIAL

Exponential

#KRIGING_GAUSSIAN

Gaussian

#KRIGING_LINEAR

Linear with sill

#KRIGING_UNIVERSAL1

Universal Kriging with linear drift

#KRIGING_UNIVERSAL2

Universal Kriging with quadratic drift


AnalysisEnvironment Example

This first example shows the use of the AnalysisPropertiesDialog.Show request to prompt the user for the settings of the AnalysisEnvironment for the active View.

theView = av.GetActiveDoc

' bring up the AnalysisPropertiesDialog

theAE = AnalysisPropertiesDialog.Show(theView,FALSE,"Analysis Properties")

' check for Cancel on dialog

if (theAE = NIL) then

  return NIL

end

' activate new settings

theAE.Activate

The AnalysisPropertiesDialog.Show request can also be used to prompt the user for a temporary AnalysisEnvironment to use for conversion. The example below shows a code fragment that prompts the user with a dialog for the extent and cell size to use for conversion if the extent and cell size of the AnalysisEnvironment for the View are not explicitly set to values.

' set extent and cell size for conversion if not already set

theAE = theView.GetExtension(AnalysisEnvironment)

theExtent = Rect.Make(0@0,1@1)

theCellSize = 1

if ((theAE.GetExtent(theExtent) <> #ANALYSISENV_VALUE) or

    (theAE.GetCellSize(theCellSize) <> #ANALYSISENV_VALUE)) then

  theCE = AnalysisPropertiesDialog.Show(theView,TRUE,"Conversion Extent")

  if (theCE = NIL) then

    return NIL

  end

  theCE.GetCellSize(theCellSize)

  theCE.GetExtent(theExtent)

end

The returned objects, theExtent and theCellSize, can be used with requests that take input from an FTab and produce a Grid object, such as the Grid.MakeFromFTab request. If the AnalysisEnvironment extent and cell size for the View are set to explicit values, then the theExtent and theCellSize objects get set to these values with the requests theAE.GetExtent and theAE.GetCellSize in the above code fragment. If the AnalysisEnvironment extent and cell size for the View are not set to explicit values, then theExtent and theCellSize objects get set to the values entered into the dialog with the requests theCE.GetExtent and theCE.GetCellSize in the above code fragment.


DensitySurface Example
Density Example

The following example creates a density GTheme from an active point Theme. It prompts the user using a dialog for input into the density calculation with the DensitySurfaceDialog.Show request. It assumes that the AnalysisEnvironment extent and cell size for the active View are set to explicit values. It also assumes that the point Theme is the only active Theme in the View.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

' obtain density parameters from dialog

densityList = DensitySurfaceDialog.Show(theTheme)

' check for Cancel from dialog

if (densityList.Count < 4) then

  return NIL

end

aField = densityList.Get(0)

aType = densityList.Get(1)

aRadius = densityList.Get(2)

aFactor = densityList.get(3)

' perform density calculation

aPrj = theView.GetProjection

theResult = Grid.MakeDensitySurface(theTheme.GetFTab,aPrj,aField,{aType, aRadius, aFactor},NIL)

' create a theme

theGTheme = GTheme.Make(theResult)

' check if output is ok

if (theResult.HasError) then

  return NIL

end

' add theme to the view

theView.AddTheme(theGTheme)


FocalStats Example
FocalStats/MakeFromPointStats Example

The following example calculates neighborhood statistics on a GTheme or point Theme. It uses the FocalStatisticsDialog.Show request to prompt the user with a dialog for parameters to pass to the aGrid.FocalStats (if input is a GTheme) or Grid.MakeFromPointStats (if input is a point Theme) requests. It assumes that the AnalysisEnvironment extent and cell size for the active View are set to explicit values, and that the explicit value for the cell size is 50. It also assumes that there is only one active Theme and that it is a GTheme or point Theme.

theView = av.GetActiveDoc

' create output for active GTheme or point FTab

theTheme = theView.GetActiveThemes.Get(0)

theCellSize = 50

' obtain type of statistic, neighborhood, and field

focalList =

    FocalStatisticsDialog.Show(theTheme,#GRID_STATYPE_MEAN,theCellSize)

if (focalList.count < 3) then return NIL end

staType = focalList.Get(0)

theNbrHood = focalList.Get(1)

theField = focalList.Get(2)

' run operation

if (theTheme.Is(GTHEME)) then

  theGrid = theTheme.GetGrid

  theResult = theGrid.FocalStats(staType,theNbrHood,FALSE)

else

  aPrj = theView.GetProjection

  theResult = Grid.MakeFromPointStats(theTheme.GetFTab,aPrj,theField,

                                      {staType,theNbrHood},NIL)

end

' create a theme

theGTheme = GTheme.Make(theResult)

if (theResult.HasError) then

  return NIL

end

' add theme to the view

theView.AddTheme(theGTheme)


AsGrid (FTab)
AsGrid

Makes a Grid by rasterizing features in anFTab. If there is a selection on anFTab, then only selected features are converted, otherwise, all features are converted.

aPrj defines the map projection that features in anFTab should be converted to before being rasterized. If the features are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField defines the Field in anFTab that will give the cells, that intersect or are contained within features, their value. Cells that don't intersect or aren't contained within any features are given the value of No Data. aField must be a numeric or string Field, or Nil. If Nil is used, then cells are assigned the value of 1.

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

Syntax

anFTab.AsGrid ( aPrj, aField, gridSize)

Returns

Grid


CalculateDensity (FTab)
CalculateDensity

Makes a Grid from the points in ptFTab using a density function.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField provides the frequency to use at each point during the density calculation. It can be a numeric Field found in ptFTab or Nil. If it is Nil, then a frequency of 1 is used at each point.

densitySpec is a List of 3 objects. It contains the following:

      0: the density function type (GridDensTypeEnum)

      1: the radius to search for input points (Number)

      2: a unit scale factor for area (Number)

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

This request is only available with the Spatial Analyst.

Syntax

ptFTab.CalculateDensity ( aPrj, aField, densitySpec, gridSize)

Returns

Grid


FocalStats (FTab)
FocalStats

Makes a Grid by calculating neighborhood statistics on the points in ptFTab.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

aField provides the value of each point to use during the calculation. It can be a numeric Field found in ptFTab or Nil. If it is Nil, then a frequency of 1 is used at each point.

statsSpec is a List of 2 objects. It contains the following:

      0: the type of statistic (GridStaTypeEnum)

      1: the type of neighborhood (NbrHood)

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

This request is only available with the Spatial Analyst.

Syntax

ptFTab.FocalStats ( aPrj , aField , statsSpec , gridSize )

Returns

Grid


Interpolate (FTab)
Interpolate

Makes a Grid by interpolating points in ptFTab using anInterp as the interpolation method.

ptFTab can be a point or multi-point FTab. If there is a selection on ptFTab, then only selected points are used, otherwise, all points are used.

aPrj defines the map projection that points should be converted to before being used. If the points are already in the desired map projection, then Prj.MakeNull can be used to create a null map projection.

zField must be a numeric field found in ptFTab.

gridSize defines the cell size and the extent for the output Grid. It can be a List or Nil. The List should first contain a Number for the cell size and then a Rect for the extent. gridSize can be set to Nil when the currently set analysis cell size and extent are desired, and Grid.SetAnalysisCellSize and Grid.SetAnalysisExtent are both set to #GRID_ENVTYPE_VALUE.

Syntax

ptFTab.Interpolate ( aPrj , zField , anInterp , gridSize )

Returns

Grid


Functional overview of Spatial Analyst classes

Object Model diagram

Loading the Spatial Analyst adds several Avenue classes.

Grid

A Grid is an object that stores spatial data within an associated data set on disk. Grids have a raster (cell-based) data structure where each cell stores a numeric data value. The Grid class provides analysis requests that produce new Grid objects from other Grid objects. A Grid object may have an associated value attribute table presented as a VTab object. If present this table shows the attributes of the Grid object. A VTab will automatically be created for an integer Grid object whose range of values is less than 100,000 or number of unique values is less than 500. Floating point Grid objects do not have an associated VTab object.

AnalysisEnvironment

The AnalysisEnvironment class is used to store the analysis environment for the Spatial Analyst extension. Each View document is associated with its own AnalysisEnvironment object that specifies a unique extent, cell size, and mask to be used when performing analysis. When performing analysis outside of the context of a View document, the analysis environment can be set independently without affecting the parameters associated with any View document. However, activation of a View document will override these temporary settings.

GTheme

The GTheme class, a subclass of the Theme class, is a View’s representation of a Grid object. Like other types of Themes; FThemes, IThemes, and DBThemes, a GTheme inherits all of the properties of the Theme class. Additionally, each Theme type has its own set of properties. A GTheme is associated with a grid data set on disk, just as a FTheme has a shapefile or coverage data source.

GLegExt

The GLegExt class supports the addition of GTheme specific information as an extension to the existing Legend class. A GLegExt object allows you to specify a second GTheme whose cell values are used to spatially modulate the brightness of the colors of each cell in the GTheme to which the Legend is applied.

Interp

The Interp class provides a complete description on how a surface should be interpolated from a point FTab. It is used with the Grid class request MakeByInterpolation. Interp objects define the interpolation method to be used and may use Radius or SVGram objects as request parameters, depending upon the method selected.

Radius

The Radius class defines the search radius for gathering input sample points from a point FTab. It is used within the Interp class requests as a parameter of the IDW or Kriging interpolation methods.

SVGram

The SVGram class is used to define a semi-variogram for the Kriging interpolation method. SVGram can also be used as a parameter within the Interp class request MakeFromVariogram.

NbrHood

The NbrHood class is involved in operations that use a specific size and shape of a group of cells. These objects are used as parameters within the Grid class instance requests BlockStats and FocalStats.

Dialogs

The dialog windows of the Spatial Analyst's user interface are accessible via Avenue. Most of these dialogs return a List of the parameters that a user enters, which then becomes input for other requests. The following classes return a List: TabulateAreaDialog, DensitySurfaceDialog, FocalStatisticsDialog, InterpolationDialog, and the ReclassEditor. The AnalysisPropertiesDialog class allows you to either directly edit a View document’s AnalysisEnvironment or to specify the cell size and extent for manipulation of Grid objects in the new AnalysisEnvironment object that’s returned.

Other dialogs that can be displayed with Avenue include the Map Query and Map Calculator dialogs, invoked with the GTheme class requests MakeQueryMap and MakeCalculationMap, respectively.


Spatial Analyst (Avenue object model diagram)
Spatial Analyst


Grid Aggregate Discussion
Aggregate Discussion

The aGrid.Aggregate request generates a reduced-resolution version of a Grid where each output cell contains the statistic value defined by aGridStaTypeEnum of the input cells that are encompassed by the extent of the output cell.

Notes

 If the values in the input Grid are integer, then the values in the output Grid will be integer. If the values in the input Grid are floating point, then the values in the output Grid will be floating point.

 The AnalysisEnvironment is recognized by the aGrid.Aggregate request. To determine the output Grid’s cell size when the AnalysisEnvironment's cell size is set to an explicit value, multiply the cell size of the AnalysisEnvironment by the cell factor (aCellFactor argument). If the cell resolution for the AnalysisEnvironment is set to Minimum or Maximum Of Inputs, the resolution of the output Grid is the product of the input Grid’s resolution multiplied by the specified aCellFactor.

Discussion

The Aggregate function resamples an input Grid to a coarser resolution based on a specified aggregation strategy (aGridStaTypEnum).

Conceptually the Aggregate function works as follows:

 First, it multiplies the cell resolution of the input Grid by the factor specified by aCellFactor. The resulting value corresponds to the cell resolution of the output Grid.

 Secondly, it maps the spatial extent of the output cells onto the input Grid.

 Next, it identifies the cells on which to perform the aggregation calculations. Cell locations from the input Grid that fall within the extent of an output cell are included in the calculations for determining that cell’s output value.

 Finally, it calculates the output value by determining the statistic value (aGridStaTypEnum) of the cells from the input Grid that fall within the output cell’s spatial extent.

Depending on the value specified for aCellFactor (if the division of the cell factor by the number of cells in a row or column leaves a remainder), the spatial extent of the input cells will not cover the same extent for the last cell in a row or column as the output Grid. When this occurs, the value for the last output cell can be calculated with the available cells from the input Grid that fall within the extent (noExpand is FALSE); or the Grid can be truncated, by removing the last cell from the output Grid (noExpand is TRUE).

The Aggregate function is similar to the aGrid.BlockStats request. Like the aGrid.BlockStats request, the aGrid.Aggregate request allows for aggregation of cell locations based on the specified statistic values within a spatial window (which is determined by a specified neighborhood). The major differences between the aGrid.BlockStats and aGrid.Aggregate requests are:

 The output Grid resulting from the Aggregate request is resampled to the desired resolution.

 There is no concept of a neighborhood in the aGrid.Aggregate request. When comparing the aGrid.Aggregate functionality in terms of aGrid.BlockStats functionality, the would-be neighborhood and output block are always square and the size of the would be neighborhood is a function of the aggregation of cells that is necessary to obtain the desired resolution.


Grid Aggregate Example
Aggregate Example

The follow example creates a GTheme of reduced resolution by returning the maximum value found in each 3 by 3 block of cells of the original GTheme. It assumes that only a single GTheme is active.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

theGrid = theTheme.GetGrid

theResult = theGrid.Aggregate(3,#GRID_STATYPE_MAX,FALSE,FALSE)

theGTheme = GTheme.Make(theResult)

' check for error during operation

if (theResult.HasError) then

  return NIL

end

theView.AddTheme(theGTheme)


Grid Aspect Discussion
Aspect Discussion

Aspect identifies the down-slope direction of the maximum rate of change in value from each cell to its neighbors. Aspect can be thought of as the slope direction. The values of the output Grid are the compass directions of the aspect.

Cells in the input Grid of zero slope (flat) are assigned an aspect of -1. If the center cell in the immediate neighborhood is No Data, the output is No Data. If any neighborhood cells are No Data, they are assigned the value of the center cell when the aspect is computed.


Grid AsPolygonFTab Example
AsPolygonFTab Example

The example converts the active GTheme to a polygon shapefile and adds the shapefile to the View as a polygon Theme. It assumes that only a single GTheme is active.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

theGrid = theTheme.GetGrid

aFileName = "c:\temp\poly.shp".AsFileName

aPrj = theView.GetProjection

theResult = theGrid.AsPolygonFTab(aFileName,TRUE,aPrj)

theFTheme = FTheme.Make(theResult)

theView.AddTheme(theFTheme)


Grid BlockStats Discussion
BlockStats Discussion

The aGrid.BlockStats request partitions the input Grid into blocks, calculates a statistic for the specified cells (defined by aNbrHood) within the blocks, and returns the calculated value to the cell locations in the corresponding blocks on the output Grid.

The maximum, minimum, mean, etc. values (defined by aGridStaTypeEnum), are calculated for a fixed set of non-overlapping windows or neighborhoods. The resulting value for an individual neighborhood is assigned to all cell locations contained in the minimum-bounding rectangle of the specified neighborhood.

If the values on the input Grid are integer, then the values on the output Grid will be integer. If the values on the input Grid are floating point, then the values on the output Grid will be floating point.

When a circular, annulus-shaped or wedge-shaped neighborhood is specified, depending on the size of the neighborhood, cells that are not perpendicular to the x- or y-axis may not be considered in the calculations. However, these cell locations will receive the resulting value from the calculations of the neighborhood because they fall within the minimum-bounding rectangle (or the output block) of the three circular neighborhoods.

Conceptually the aGrid.BlockStats request works as follows:

 It creates the first specified neighborhood (for example, a circular neighborhood) in the top left corner of the input Grid.

 It calculates the minimum-bounding rectangle in order to determine the size of the output block.

 It partitions the remaining area of the Grid into defined blocks, or into a defined block (no blocks can overlap).

 It identifies in each block the cell locations that will be used in the block calculations. The cell locations are determined by the definition of the specified neighborhood (for example, a circular neighborhood) that fits into the bounding rectangle.

 It calculates the output value for each neighborhood of each block. The resultant values are assigned to every cell location in the corresponding output block.

There are two differences between the aGrid.BlockStats and the aGrid.FocalStats requests:

 First, the neighborhoods in the aGrid.BlockStats request do not overlap, while the neighborhoods in the aGrid.FocalStats request are based around a processing cell and always overlap.

 Second, in the aGrid.BlockStats request a block of cells corresponding to the minimum-bounding rectangle of a neighborhood receives the resulting value, while in the aGrid.FocalStats request only the processing cell receives the resulting value.

The aGrid.BlockStats request can be used to control the resampling a Grid from a finer resolution to a coarser one. Instead of using the nearest-neighbor, bilinear, or cubic resampling techniques, it may be preferable to assign the coarser Grid cells the maximum, minimum, or the average of the values in the new geographic extent the coarser cells encompass. To do so, the appropriate block statistic type is applied. The resulting Grid can be used in future computations; or a new, coarser Grid can be made from the resulting Grid by setting the cell size for the AnalysisEnvironment to the desired coarser resolution and issuing the following expression:

outCoarseGrid = fineGrid

The aGrid.Aggregate request is another function that is similar to the aGrid.BlockStats request. Like the aGrid.BlockStats request, aGrid.Aggregate allows for the aggregation of cell locations based on the sum, mean, or median, or the minimum or maximum values within a spatial window (which is determined by the desired output resolution). The major differences between the aGrid.BlockStats and aGrid.Aggregate requests are two:

 The output Grid resulting from the aGrid.Aggregate request is resampled to the desired resolution.

 There is no concept of a specified neighborhood in the aGrid.Aggregate request. The neighborhood and the output block are the same and always rectangular and encompass the same cell locations. The size of the block in the aGrid.Aggregate request is determined by the aggregation of cells that is necessary to reach the desired resolution.


Grid BlockStats Example
BlockStats Example

The following example uses the aGrid.BlockStats request to calculate the median value within a circular neighborhood with a 5 cell radius to create a new GTheme from the active GTheme. It assumes that only a single GTheme is active.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

theGrid = theTheme.GetGrid

theNbrHood = NbrHood.MakeCircle(5,FALSE)

theResult = theGrid.BlockStats(#GRID_STATYPE_MEDIAN,theNbrHood,TRUE)

theGTheme = GTheme.Make(theResult)

' check for error during operation

if (theResult.HasError) then

  return NIL

end

theView.AddTheme(theGTheme)


Grid Contour Discussion
Contour Discussion

Notes

 Contours do not extend beyond the extent of the Grid, and they are not generated in areas of No Data.

 Contours may be generated in areas of negative Grid values. They will have negative contour values in such areas. It is not necessary to use a negative contour interval.

 Smoother but less accurate contours may be obtained by running the aGrid.FocalStats request with #GRID_STATYPE_MEAN for aGridStaTypeEnum on the Grid before contouring.

 A base contour is used, for example, when you want to create contours every 15 meters, starting at 10 meters. Here 10 would be used for the baseContour, and 15 would be the anInterval. The values to be contoured would be -5, 10, 25, 40, 55, etc.

 Specifying a base contour does not prevent contours from being created above or below that value.

Discussion

The contour requests are used to create lines of isolines or contours, representing constant cell values in the input Grid.

Occasionally, contours may be created that have square or blocky outlines, appearing to follow Grid cell boundaries. This can occur when the Grid values are integers and they fall exactly on a contour. This is not a bug, merely an exact contouring of the data. There are three ways to overcome this condition if you would like smoother contours: by smoothing the surface (using the aGrid.FocalStats request with aGridStaTypEnum of #GRID_STATYPE_MEAN), by adjusting the baseContour, or both.

Adjusting the baseContour involves offsetting the base contour such that the contours no longer pass exactly through the cell centers of an integer Grid. The offset can be very small; values as small as 0.0001 have been found effective.

The contour requests produce engineering-quality contours, representing an exact interpretation of the Grid surface model. Overall contour accuracy depends on how well the data used to create the input Grid represents the actual surface.

The size of the Grid cells used affects the appearance of the output contours. A large cell size may result in coarse, blocky looking contours.

Occasionally, engineering-quality contours may cross, appear to intersect, or form an unclosed branching line. Crossing contours can occur in saddle regions that lie exactly on a contour interval. In other cases, the contours may pass so close to one another that they may appear to intersect.  Branching contours can occur in cases of intersecting ridges that fall exactly on a contour interval. These are all valid engineering-quality interpretations of the surface that cartographers typically modify for aesthetic purposes.


Grid Con Discussion
Con Discussion

The aGrid.Con ( yesGrid, noGrid ) request performs a conditional if/else evaluation on a cell-by-cell basis. aGrid can be any valid Boolean or relational expression involving multiple Grids and Numbers (after being converted to Grids with aNumb.AsGrid). Cells for which the expression is TRUE are given the value found in yesGrid. Cells for which the expression is FALSE are given the value found in noGrid. If aGrid is a single Grid, then cells which are non-zero are given the value found in yesGrid, while values of 0 are given the value found in noGrid. The yesGrid or noGrid can be a single Grid, or any valid expression involving operators and requests that result in a Grid object.

A value of No Data in aGrid does not receive the value of the noGrid, it remains as No Data.

To understand the aGrid.Con request, you must first break it into smaller components.  For example, in the expression

outGrid = (inGrid > 5.AsGrid).Con(100.AsGrid, 50.AsGrid)

the "(inGrid > 5.AsGrid)" is the condition, "100.AsGrid" is what is returned if the expression is TRUE, and "50.AsGrid" is what is returned if the expression is FALSE.  The logic underlying the expression is that if the value of inGrid is greater than 5, then assign the value of 100 to outGrid, and if the value of inGrid is 5 or less, then assign the value of 50 to outGrid.

A more complex example is an embedded aGrid.Con request within another aGrid.Con request:

outGrid = (inGrid >= 20.AsGrid).Con(

           (inGrid < 50.AsGrid).Con(40.AsGrid, 100.AsGrid), 200.AsGrid)

Here, the condition for the first aGrid.Con request is "(inGrid >= 20)".  The other aGrid.Con request, "(inGrid < 50.AsGrid).Con(40.AsGrid, 100.AsGrid)", is returned if the condition is TRUE.  If the condition is FALSE, then "200.AsGrid" is returned.  The condition for the embedded aGrid.Con request is "(inGrid < 50.AsGrid)".  If the condition for the embedded aGrid.Con request is TRUE, then "40.AsGrid" is returned.  If it is FALSE, then "100.AsGrid" is returned.  The logic of the expression follows:  if the value of inGrid is greater than or equal to 20 but less than 50, assign the value of 40 to outGrid.  If the value of inGrid is greater than 50, assign the value of 100 to outGrid. If the value of inGrid is less than 20, assign the value of 200 to outGrid.


Grid Con Example
Con Example

The aGrid.Con request allows you to perform if/else type modeling with Grids. The following code fragment creates newGrid from inGrid using the following logic:

 If the value of inGrid is less than or equal to 5, then take the sine of the value.

 If the value of inGrid is 6, 7, 8, 9, or 10, then take the cosine of the value.

 If the value of inGrid is greater than 10, then return the orginal value.

You could solve this a step at a time by creating a Grid for the first condition that set cells that did not meet the condition to No Data and taking the sine of the cells that did. Then you could use this Grid to see if any No Data cells matched the second condition and take the cosine of them. The third step would be to convert the remaining No Data cells to their original value.

tempGrid1 = (inGrid > 5.AsGrid).SetNull(inGrid.Sin)

tempGrid2 = (tempGrid1.IsNull and (inGrid > 10.AsGrid)).Con(

                                             tempGrid2,inGrid.Cos)

newGrid = (tempGrid2.IsNull).Con(inGrid,tempGrid2)

By nesting the aGrid.Con requests the above can be done much simpler by nesting the conditions like below.

newGrid = (inGrid > 10.AsGrid).Con(inGrid,(inGrid <= 5.AsGrid).Con(

                                                  inGrid.Sin,inGrid.Cos))

The above checks for the condition of inGrid greater than 10. If this is TRUE, then it returns the orginal value. If it is FALSE, it checks to see if it is less than or equal to 5. If it is, then it takes the sine. If it is not, then it takes the cosine.


Grid CostDistance Discussion
Cost Distance Modeling Discussion

These functions are similar to Euclidean distance functions, but instead of calculating the actual distance from one point to another, they determine the shortest cost distance (or accumulated travel cost) from each cell to the nearest cell in the set of source cells. A second exception is that cost distance functions apply distance not in geographic units but in cost units.

All cost distance functions require a source Grid and a cost Grid. A source Grid can contain single or multiple zones, which may or may not be connected. All cells that have a value (including 0) are processed as source cells. All non-source cells need to be assigned No Data on the source Grid.

A cost Grid assigns an impedance in some uniform-unit measurement system that depicts the cost involved in moving through any particular cell. The value of each cell in the cost Grid is assumed to represent the cost-per-unit distance of passing through the cell, where a unit distance corresponds to the cell width. These costs may be travel time, dollars, preference and so forth.

The Cost Calculations

The aGrid.CostDistance request creates an output Grid in which each cell is assigned the accumulative cost to the closest source cell. The algorithm utilizes the node/link cell representation. In the node/link representation, each center of a cell is considered a node and each node is connected by links to its adjacent nodes.

Every link has an impedance associated with it. The impedance is derived from the costs associated with the cells at each end of the link (from the cost surface) and from the direction of movement. If moving from a cell to one of its four directly connected neighbors, the cost to move across the links to the neighboring node is 1 times the cost of cell 1 plus the cost of cell 2 divided by 2.

a1 = cost1 + cost2 / 2

where cost1 is the cost of cell 1, cost2 is the cost of cell 2 and a1 is the length of the link from cell 1 to cell 2.

The accumulative cost is determined by the following formula.

accum_cost = a1 + (cost2 + cost3) / 2

where cost2 is the cost of cell 2, cost3 is the cost of cell 3 and accum_cost is the accumulative cost to move into cell 3 and cell 1.

If the movement is diagonal, the cost to travel over the link is 1.414216 (or the square root of 2), times the cost of cell 1 plus the cost of cell  2 divided by 2.

a1 = 1.414216(cost1 + cost2) / 2

But when determining the accumulative cost for diagonal movement the following formula must be used.

accum_cost = a1 + 1.414216(cost2 + cost3) / 2

The Algorithm

Creating an accumulative cost-distance Grid using graph theory can be viewed as an attempt to identify the lowest cost cell and adding it to an output list. It is an iterative process that begins with the source cells. The goal of each cell is to be assigned quickly to the output cost-distance Grid.

In the first iteration, the source cells are identified and assigned to zero since there is no accumulative cost to return to themselves. Next, all the source cell’s neighbors are activated and a cost is assigned to the links between the source cells nodes and the neighborhood cell’s nodes using the above accumulative cost formulas. Each of these neighborhood cells can now reach a source, consequently, they can be chosen or assigned to the output accumulative cost Grid. To be assigned to the output Grid, a cell must have the next least-cost path to a source.

The accumulative cost values are arranged in a list from the lowest accumulative cost to the highest.

The lowest cost cell is chosen from the active cost list and the value for that cell location is assigned to the output cost-distance Grid. The list of active cells is now expanded to include the neighbors of the chosen cell, because those cells now have a way to reach a source. Only those cells that can possibly reach a source can be active in the list. The cost to move into these cells is calculated using the accumulative cost formulas.

Again, the active cell on the list with the lowest cost is chosen, the neighborhood is expanded, the new costs are calculated and these new cost cells are added to the active list

Source cells do not have to be connected. All disconnected sources contribute equally to the active list. Only the cell with the lowest accumulative cost is chosen and expanded, regardless of the source to which it will be allocated.

Furthermore, cells on the active list are updated if a new, cheaper route is created by the addition of new cell locations to the output Grid.

This updating can occur with the advent of new paths for cells on the active list as more cells are allocated to the output Grid. When the cell with the lowest value on the active accumulative cost list is allocated to the output Grid, all the accumulative costs are calculated. These costs are also calculated for the neighboring cells of the newly assigned output cell, even if the neighboring cells are on the active list through another cell. If the new accumulative cost for the locations on the active list is greater than the one that the cells currently has, the value is ignored. If the accumulative cost is less, then the old accumulative cost for the location is replaced on the active list with the new value. That cell, which has discovered a cheaper and more desirable path to a source, then moves up on the active chosen list. In the example below, the cell location at row 3, column 1 (highlighted by the box) had an accumulative cost of 11.0 when it was put on the active list to reach the source at the top of the Grid. But because the lower source expanded to this location, the cell had access to a cheaper accumulative cost path to reach a source. The value for the location was updated on the active list and allocated to the output earlier, because of this lower accumulative cost.

If there are multiple zones or disconnected sets of source cells on the input source Grid, the growing process continues and allocates the cheapest cost cell from the active list, regardless of which source it is from. When the growth fronts meet, the least cost path back to the source proceeds until all eligible cells have received a cost value.

It is conceivable that when the growing patterns meet, cells from one growth pattern will discover that they can reach a source cell in another set or growth pattern more cheaply; if so, they will be reassigned to the new source. This behavior was witnessed by the cell at row 3, column 1 earlier, but is also exemplified below by the cell located at row 3, column 6.

When all cells have been chosen from the active list, the result is the accumulative-cost or weighted-distance Grid. The procedure used ensures that the lowest accumulative cost is guaranteed for each cell.

Cost Back Link

The cost-distance Grid identifies the accumulative cost for each cell to return to the closest cell in the set of source cells. It does not show which source cell to return to or how to get there. The cost back link returns a Grid with a value range from 0 to 8 that can be used to reconstruct the route to the source. Each value (0 through 8) identifies which neighboring cell to move into to get back to the source. 0 is a source, 1 indicates move to the immediate right, 2 to the lower right diagonal, 3 to the cell immediately south, etc..

If the cell is assigned 5 as part of the least cost path to a source, the path should move to the left neighboring cell. If that cell has 7, the path should move due north.

Cost Allocation

Cost allocation produces a Grid very similar to the Euclidean allocation function; like the Euclidean function, it returns a Grid identifying which cells will be allocated to which source, but unlike the Euclidean function, on the basis of the lowest accumulative cost to reach a source.

Cost Path

Once the accumulative cost and back-link Grids are created, least-cost path routes can be derived from any designated destination cell or zone(s). The cost-path request retraces the destination cells through the back-link Grid to a source. If there are multiple cells or zones as input destinations, the least cost path can be calculated from each cell (resulting in multiple paths, one path for each cell), or each zone (one path from each zone).

When two or more cost paths from different zones converge on the way to a source and continue the remaining distance together, the joint path to the cell is assigned 2, since the owner of the segment cannot be determined. The value assigned to each path is assigned by the order in which the zone cells are encountered in the scanning process.

The set of source cells consists of all cells in the source Grid that have valid values. Cells that have No Data values are not included in the source set. The value 0 is considered a legitimate source. Cell locations with No Data in the cost Grid act as barriers in the cost surface functions. Any cell location that is assigned No Data on the input cost surface will receive No Data on all three output Grids of the aGrid.CostDistance request. If a mask has been set in the analysis environment, any masked cells will be treated as No Data values.


Grid Curvature Discussion
Curvature Discussion

The aGrid.Curvature request calculates the curvature of a surface at each cell center, and optionally, the slope and aspect.

Notes

 A positive curvature indicates that the surface is upwardly convex at that cell.  A negative curvature indicates that the surface is upwardly concave at that cell.  A value of zero indicates that the surface is flat.

 Units of the curvature output Grid as well as the units for the optional proCurvFN and planCurvFN output grid data sets are one over 100 zunits, or 1/100(zunits).  The reasonably expected values of all three output Grids for a hilly area (moderate relief) may differ from about -0.5 to 0.5, while for the steep rugged mountains (extreme relief), the values may vary between -4 and 4.

 The units of slopeFN are degrees. Values may vary from 0 to 90.

 Aspect (aspectFN) is expressed in positive degrees from 0 to 359.9, measured clockwise from the north. An aspect value of -1 indicates an area of undefined aspect (i.e., flat). The direction of slope is defined by the value of aspect.

Discussion

The curvature of a surface is calculated on a cell-by-cell basis. For each cell, a fourth-order polynomial of the form

Z = Ax2y2 + Bx2y + Cxy2 + Dx2 + Ey2 + Fxy + Gx + Hy + I

is fit to a surface composed of a 3x3 window. The coefficients a, b, c, and so on, are calculated from this surface.

A = [(Z1 + Z3 + Z7 + Z9) /4  - (Z2 + Z4 + Z6 + Z8) /2 + Z5] /L4

B = [(Z1 + Z3  - Z7 - Z9) /4  -  (Z2 - Z8) /2] /L3

C = [(-Z1 + Z3 - Z7 + Z9) /4 + ( Z4 - Z6)] /2] /L3

D = [(Z4 + Z6) /2 - Z5] /L2

E = [(Z2 + Z8) /2 - Z5] /L2

F = (-Z1 + Z3 + Z7 - Z9) /4L2

G = (-Z4 +Z6) /2L

H = (Z2 - Z8) /2L

I = Z5

The output of the aGrid.Curvature request is the second derivative of the surface (i.e., the slope of the slope), such that

Curvature = -2(D + E) * 100

From an applied viewpoint, the output of the aGrid.Curvature request can be used to describe the physical characteristics of a drainage basin in an effort to understand erosion and runoff processes. The slope (slopeFN) affects the overall rate of movement down slope. Aspect (aspectFN) defines the direction of flow. The profile curvature (proCurvFN) affects the acceleration and deceleration of flow, and therefore influences erosion and deposition. The planform curvature (planCurvFN) influences convergence and divergence of flow.


Grid Discussion

Temporary Data Sets

Grids created as the result of an analysis request will, in general, be associated with a temporary grid data set that stores the resulting spatial data on disk. This allows you to perform analysis without having to worry about filling up your disk with unwanted intermediate grid data sets. It does make it your responsibility to save the grid data set associated with a Grid to a permanent workspace using the aGrid.SaveDataSet request for grid data sets that are wanted outside of a project or by another user. A temporary data set is only deleted from disk once the Grid object that references it is no longer needed. If the Grid is not reference by a GTheme or the aGrid.SaveDataSet is not used, then it will be deleted when the running of a script is complete. If its data set is temporary, it will also be deleted. If a GTheme is deleted or not saved with a project, then the data set of the Grid that is referenced by it is deleted if it is temporary. The action of saving a project will cause all temporary data sets associated with Grids that are referenced by GThemes in the project to become permanent.

Deferred Evaluation

Deferred evaluation means that a new Grid object is not evaluated (the associated grid data set is not written to disk) until another process absolutely needs to read cell values from that Grid object’s associated grid data source on disk. This allows multiple computations to be executed at once, minimizing the number of times ArcView reads or writes grid data sets.

A brief example can help to explain:

aGrid = theElev + 33.AsGrid

bGrid = aGrid * 5.AsGrid

cGrid = bGrid / 2.AsGrid

theStatsList = cGrid.GetStatistics

The above Grid objects (aGrid, bGrid, and cGrid) are not evaluated until the cGrid.GetStatistics request is reached. The Spatial Analyst stores the three preceding statements in memory and waits until it absolutely needs to compute them. This way, only one grid data set (cGrid) is being written to disk.

Other requests of the Grid class that trigger evaluation are Rename, SaveDataSet, SaveAsASCII, SaveAsFloat, EucDistance, EucAllocation, CostDistance, Curvature, GetExtent, GetNumRowsAndCols, GetCellSize, GetVTab, GetSrcName, IsInteger, CellValue, PointValue, CellValueList, PointValueList, BuildSTA, and BuildVAT.

The only request of the GTheme class that triggers evaluation is Make.

Error Checking

One of ArcView’s most helpful error checking requests, HasError, is built into the Spatial Analyst as a Grid class request to ensure that Grid objects are created properly. Traditional Avenue NIL error checking cannot be performed on Grid objects because in the Spatial Analyst, the equal operator (=) evaluates the equal-to relation of one Grid relative to another Grid on a cell by cell basis. The following example shows how not to error check Grid objects:

‘ INCORRECT ERROR CHECKING OF A GRID OBJECT

if (Grid = NIL) then return NIL end

Instead, when a Grid object is created, the Spatial Analyst tags the object with a HasError flag. This flag is either TRUE, where the Grid object has an error, or FALSE, where the Grid object is correct. This means that as soon as a grid data source is read from disk, or when a new Grid object is created within an ArcView session, the HasError flag is set.

Therefore, error checking a newly created Grid object with the HasError request can only happen after evaluation of the Grid object has already occurred. Checking a Grid object for errors must occur in this fashion.

We can improve the example from the above “Deferred Evaluation” section to help explain:

aGrid = theElev + 33.AsGrid

bGrid = aGrid * 5.AsGrid

cGrid = bGrid / 2.AsGrid

theStatsList = cGrid.GetStatistics

if (cGrid.HasError) then

  MsgBox.Info("cGrid.HasError = TRUE", "ERROR")

  return NIL

end

Checking for HasError should happen after the Grid object (cGrid) is evaluated. A request that attempts to use a Grid object in which the HasError flag is TRUE will fail.

Using Grids and Numbers Together

When using a Number within Spatial Analyst requests, whether you use the Map Calculator or a Script Editor, you must convert it to a Grid object with the aNumb.AsGrid request in order for it to be used as a Grid. This is because Avenue requires that objects on either side of an operator, such as +, be of the same type. In this case, all objects involved are Grids.

newGrid = 8.AsGrid + theGrid

If you don’t use aNumb.AsGrid, Avenue will interpret the 8 as a Number object, instead of adding a Grid object (where all cells have the value of 8) to another Grid object (theGrid).

The one exception to this is when a Number follows the operator and the Grid precedes the operator. When a Grid object is seen first, followed by an operator the Spatial Analyst expects the operator to be followed by a Grid or Number. If it is a Number object it is assumed to be a Grid object and is automatically converted to a Grid object. So the following example works.

NewGrid = theGrid + 8

To be safe you should always use the aNumb.AsGrid request when you want a Number to be treated as a Grid object.

Conversely, if a number is used as a parameter of a request, then just use the number.

newGrid = theGrid.Resample(100, #GRID_RESTYPE_CUBIC)

In this case, the number 100 means a new cell size of 100 map units.

Levels of Analysis

The Grid class provides a large number of analysis requests. Analysis requests operate on the Grid that is the target of the request and generate a new resultant Grid with an associated data set on disk.

The analysis requests can be classified into four categories based on the amount of information (level) that is used to compute the value at each cell in the output Grid

 Local Requests - The value at each cell in the output Grid depends only on the value of corresponding cells in the input Grid(s). For example the aGrid.Log request applied to a Grid results in a new Grid in which each cell stores the natural logarithm of the value of the corresponding cell in the target Grid. Examples of Local Requests include the Trigonometric, Exponential, Reclassification and Local Statistic requests.

 Focal and Block Requests - The value at each cell in the output Grid depends on the value of a specified neighborhood of cells in the input Grids. Examples include the aGrid.FocalStats and aGrid.BlockStats requests.

 Zonal Requests - The value at each cell in the output Grid depends on the value of all cells in the input Grids that share the same zone. A zone is a set of locations defined by a common value in a zone Grid or FTab. Examples include the aGrid.ZonalStats requests.

 Global Requests - The value at each cell in the output Grid potentially depends on all cells in the input Grids. Examples include the aGrid.EucDistance and aGrid.Watershed requests.


Grid EucDistance Discussion
Euclidean Distance Modeling Discussion

Three output Grids are potentially available from the Euclidean distance requests. These Grids describe each cell’s Euclidean relationship to a source or to a set of source cells. The Euclidean distance Grid identifies the distance from each cell to the closest source cell; the Euclidean direction Grid gives the direction from each cell to the closest source cell; and the Euclidean allocation Grid identifies which cells are allocated to which source based on closest proximity.

Each Grid can be derived separately by running one of the two requests (aGrid.EucDistance or aGrid.EucAllocation), or each request can derive all three Grids as output. No prerequisites exist between requests, which can be run independently at any time.

Euclidean distance is calculated from the center of the source cell to the center of each of the surrounding cells. True Euclidean distance is calculated in each of the distance functions. Conceptually the Euclidean algorithm works as follows: for each cell, the distance to each source cell is determined by calculating the hypotenuse with the x_max and y_max as the other two legs of the triangle. This calculation derives the true Euclidean, rather than the cell distance. The shortest distance to a source is determined, and if it is less than the specified maximum distance, the value is assigned to the cell.

The output values for the Euclidean distance Grid are floating-point distance values. If a cell is at an equal distance from two or more sources, it is assigned to the source that is first encountered in the scanning process (scanning begins at the upper left and moves from left-to-right, top-to-bottom).

The above description is only a conceptual depiction of how values are derived. The actual algorithm computes the information using a two-scan sequential process. Using this process makes the speed of the function independent from the number of source cells, the distribution of the source cells, and the maximum distance specified. The only factor that influences the speed with which the function executes is the size of the Grid.

Euclidean direction assigns the direction in degrees of each cell to its nearest source. A 360-degree circle or compass is used, with 360 being to the north and 1, a degree to the east; the remaining values increase clockwise. The value 0 is reserved for the source cells.

Euclidean allocation produces an output Grid that records for each cell the identity of the closest source cell. Each cell in an allocation receives the value of the source to which it is allocated.

In the source Grid, the sources are all of the cells with values other than No Data and all Euclidean functions are calculated from non-source cells assigned No Data. The value 0 is considered a legitimate source. Source cells that are masked with the mask of the AnalysisEnvironment will not be considered in the computations. These cell locations are assigned No Data on all three output Grids.


Grid FlowAccumulation Discussion
FlowAccumulation Discussion

The aGrid.FlowAccumulation request creates a Grid of accumulated flow to each cell, by accumulating the weight for all cells that flow into each downslope cell.

Notes

 Cells of undefined flow direction will only receive flow, they will not contribute to any downstream flow. A cell is considered to have an undefined flow direction if its value in the flow direction Grid is anything other than 1, 2, 4, 8, 16, 32, 64, or 128.

 The accumulated flow is based upon the number of cells flowing into each cell in the output Grid. The current processing cell is not considered in this accumulation.

 Output cells with a high flow accumulation are areas of concentrated flow and may be used to identify stream channels.

 Output cells with a flow accumulation of 0 are local topographic highs and may be used to identify ridges.

 If the flow direction Grid is not created with the aGrid.FlowDirection request there is a chance that the defined flow could loop. If the flow direction does loop the aGrid.FlowAccumulation request will go into an infinite loop and never finish.

The weightGrid might be used to determine how much rain might run out of a given watershed. In such a case, the weightGrid may be a continuous Grid representing average rainfall during a given storm. The output of flow accumulation would then represent the amount of rain that would flow through each cell, assuming that all rain became runoff and there was no interception, evapotranspiration, or loss to groundwater. This could also be viewed as the amount of rain that fell on the surface, upslope from each cell.

The following graphic shows the results of the default usage of the aGrid.FlowAccumulation request.

The results of flow accumulation can be used to create a stream network by applying a threshold value to subset cells with a high accumulated flow. For example, the Avenue statement to create a Grid where the value 1 represents the stream network on a background of No Data could be:

streamNet = (flowAcc < 100.AsGrid).SetNull(1.AsGrid)

All cells that have more than 100 cells flowing into them are assigned 1; all other cells are assigned No Data. For future processing, it is important that the stream network, a set of raster linear features, be represented as values on a background of No Data.

The resulting stream network can be used as input to the aGrid.StreamOrder and aGrid.StreamLink requests.

This method of deriving accumulated flow from a DEM is presented in Jenson and Domingue 1988. An analytical method for determining an appropriate threshold value for stream network delineation is presented in Tarboton et al. 1991.

References

Jenson S. K. and J. O. Domingue. 1988. Extracting Topographic Structure from Digital Elevation Data for Geographic Information System Analysis, Photogrammetric Engineering and Remote Sensing. Vol. 54, No. 11, November 1988, pp. 1593-1600.

Tarboton D. G., R. L. Bras, I. Rodriguez-Iturbe. 1991. On the Extraction of Channel Networks from Digital Elevation Data, Hydrological Processes. Vol. 5, pp. 81-100.


Grid FlowDirection Discussion
FlowDirection Discussion

The aGrid.FlowDirection request calculates the direction of flow out of each cell into one of its eight neighbors.

Notes

 The output of the aGrid.FlowDirection request is an integer Grid whose values range from 1 to 255. The values for each direction from the center are:

32   64   128

16    X      1

 8     4      2

For example, if the direction of steepest drop was to the left of the current processing cell, its flow direction would be coded as 16.

 If a cell is lower than its 8 neighbors, that cell is given the value of its lowest neighbor and flow is defined towards this cell. If multiple neighbors have the lowest value the cell is still given this value, but flow is defined with one of the two methods explained below. This is used to filter out one cell sinks which are considered noise.

 If a cell has the same change in z value in multiple directions and that cell is part of a sink, the flow direction is referred to as undefined. In such cases, the value for that cell in the output flow-direction Grid will be the sum of those directions. For example, if the change in z value is the same both to the right (flow direction = 1) and down (flow direction = 4), the flow direction for that cell is 1 + 4 = 5. Cells with undefined flow direction can be flagged as sinks using the aGrid.Sink request.

 If a cell has the same change in z value in multiple directions and is not part of a sink, the flow direction is assigned with a lookup table defining the most likely direction. See Greenlee, 1987.

 When forceEdge is FALSE, cells at the edge of the surface Grid will flow toward the inner cell with the steepest drop in z value. If the drop is less than or equal to zero, the cell will flow out of the surface Grid.

 Downstream tracing can be done by using the flow direction Grid as the backlink Grid for input to the aGrid.ReturnCostPath request.

Discussion

The direction of flow is determined by finding the direction of steepest descent from each cell. This is calculated as

drop = change in z value / distance * 100

The distance is determined between cell centers. Therefore if the cell size is 1, the distance between two orthogonal cells is 1 and the distance between two diagonal cells is 1.414214.

If the descent to all adjacent cells is the same, the neighborhood is enlarged until a steepest descent is found.

This method of deriving flow direction from a DEM is presented in Jenson and Domingue, 1988.

References

Greenlee D. D. 1987. Raster and Vector Processing for Scanned Linework, Photogrammetric Engineering and Remote Sensing. Vol. 53, No. 10, October 1987, pp. 1383-1387.

Jenson S. K. and J. O. Domingue. 1988. Extracting Topographic Structure from Digital Elevation Data for Geographic Information System Analysis, Photogrammetric Engineering and Remote Sensing. Vol. 54, No. 11, November 1988, pp. 1593-1600.


Grid FlowLength Discussion
FlowLength Discussion

The aGrid.FlowLength request calculates upstream or downstream distance along a flow path for each cell.

A primary use of the aGrid.FlowLength request is to calculate the length of the longest flow path within a drainage basin or watershed. This measure is often used to calculate the time of concentration of a basin.

Flow length can also be used to create distance-area diagrams of hypothetical rainfall/runoff events using the weightGrid argument as an impedance to movement downslope.


Grid FocalFlow Discussion
FocalFlow Discussion

The aGrid.FocalFlow request determines the flow of the values in a Grid within each cell’s immediate neighborhood.

Notes

 The output of the aGrid.FocalFlow request is always an integer value.

 The resulting values of focal flow measure flow into, not out of a cell.

 The aThreshold value can be either an integer or floating-point value.

 The output values of a function are derived from the binary representation of the results of the analysis (see discussion below for additional information).

Discussion

The output values of the aGrid.FocalFlow request are derived from the binary representation of the results of the analysis. The basic assumption of the request is that if the value of a cell in the immediate eight-cell neighborhood is greater than the value of the processing cell, then the neighboring cell will flow into the processing cell (this flow corresponds to the way water moves into locations at lower elevations or to the way liquid migrates to areas with less concentration). To test whether a particular neighborhood cell will flow into the processing cell, the value of each neighborhood cell is subtracted from the processing cell. If a value is positive, the neighborhood cell does not flow into the processing cell, and if it is negative, it does. If no cells flow into the processing cell, then the location will receive a value of 0.

If aThreshold has been entered, the difference between the value of the neighborhood cell minus the value of the processing cell must be greater that threshold for flow to occur. If it is not, then there is no flow from the neighborhood cell.

The representation of the combination of flow from multiple neighborhood cells into a single processing cell is accomplished through the binary representation of the processing cell. Each bit of the binary representation for the processing cell correlates to a neighborhood cell location, the neighbor to the immediate right is 1, the neighbor to the lower right is 2, and so forth until the value of 128 (powers of two since representation occurs in binary), the neighbor to the upper right is reached.

If a neighborhood cell flows into the processing cell, the bit that represents the neighborhood location (see above diagram) is turned on (or assigned a 1). If a neighborhood cell does not flow into the processing cell, the bit that represents the location is 0. Once all neighborhood locations have been tested for flow, none, one, several, or all bits can be turned on (or assigned 1). The binary representation for all bits is then converted back to base10 in accordance with the flow-bit pattern. The base10 number is then assigned to the processing cell.

The above encoding assigns a unique number to each possible combination of upstream numbers. For example, a cell location into which neighbors 1 and 3 flow would receive an output value of (4 + 1) = 5. The total number of combinations of flow into a processing cell is 255. For example, a cell into which all adjacent neighbors flow would receive a value of (128 + 64  + 32 + 16 + 8 + 4 + 2 +1) = 255. The output Grid from the aGrid.FocalFlow request can also be effectively analyzed using the bitwise operators (for additional information, see the list of Operators for the Grid class).


Grid FocalStats Discussion
FocalStats Discussion

For each cell location on in aGrid, the aGrid.FocalStats request calculates the statistic in aGridStaTypeEnum within aNbrHood and sends it to the corresponding cell location on the output grid.

Note

 If the values in the input grid are integer, then the values on the output grid will be integer.  If the values on the input grid are floating point, then the values on the output grid will be floating point.

Discussion

Conceptually the aGrid.FocalStats request works as follows:

 It creates the first specified neighborhood (for example, a circular neighborhood) using the top left cell of the input Grid as the center of that neighborhood.

 It identifies in each neighborhood the cell locations that will be used in the focal calculations. The cell locations are determined by the definition of the specified neighborhood (for example, a circular neighborhood).

 It calculates the output value for the neighborhood and returns the value to processing cell only.

 It then moves to the cell to the right of the previous cell and starts over. This is done for every cell in the Grid.

There are two differences between the aGrid.BlockStats and the aGrid.FocalStats request are:

 First, the neighborhoods in the aGrid.BlockStats request do not overlap, while the neighborhoods in the aGrid.FocalStats request are based around a processing cell and always overlap.

 Second, in the aGrid.BlockStats request a block of cells corresponding to the minimum-bounding rectangle of a neighborhood receives the resulting value, while in the aGrid.FocalStats request only the processing cell receives the resulting value.


Grid HillShade Discussion
HillShade Discussion

Analytical hillshading is a way to determine the hypothetical illumination of a surface. The aGrid.HillShade request creates a shaded relief Grid for an input continuous surface Grid. The distance of the illumination source to the surface is considered to be at infinity. The aGrid.HillShade request calculation considers the effects of both the local illumination angle and shadow. The analysis of shadows is done by considering the effects of the local horizon at each cell. Grid cells in shadow are assigned a value of 0.

You can give the display of a GTheme a three-dimensional look by using the resulting hillshade surface to vary brightness of its colors. To do so, double-click on the desired GTheme. Press Advanced button on the Legend Editor and choose the hillshade surface theme in the Brightness Theme dropdown list.


Grid IsNull Example
IsNull Example

The value of No Data is not a number that you can access. If you need to query if a cell value is No Data, then the aGrid.IsNull request is used. The line of code below converts No Data cells to the value of 31.

outGrid = inGrid.IsNull.Con(31.AsGrid,inGrid)


Grid MakeDensitySurface Discussion
MakeDensitySurface Discussion

The Grid.MakeDensitySurface request calculates the density of point features around each output Grid cell. Density is calculated as the value of points per unit of area. The default unit of area is 1 square map unit. Conceptually, with the Simple option (defined in the densitySpec) a circle is drawn around each Grid cell center using a radius (defined in the densitySpec), and the number of points that fall within the circle is totaled and divided by the circle's area.

With the Kernel option (defined in the densitySpec), a smoothly curved surface is fitted over each point. Its value is highest when you are right on the point, and this diminishes as you move away from the point, reaching 0 at the radius distance from the point defined in the densitySpec. The density at each output Grid cell is calculated by adding the values of all the kernel surfaces where they overlay the Grid cell center. The use of the kernel function in density estimation is described in Silverman (1986).

If aField is not NIL, the Field value determines the number of times to count the point. Thus an Field value of 3 would cause the point to be counted as 3 points. If a unit scale factor of area is specified in the densitySpec, the calculated density for the cell is multiplied by the square of the unit scale factor of area before it is written to the output Grid.

Possible uses include finding density of houses, wildlife observations, or crime reports. The aField could be used to weight some points more heavily than others, depending on their meaning, or to allow one point to represent several observations. For example, one address might represent a condominium with 6 units, or some crimes might be weighted more severely than others in determining overall crime levels.

Here are some examples of using the unit scale factor of area to change the units of the output density:

 Map units are meters, so default units of density is value of points per square meter in the neighborhood. It is desired to calculate density as per hectare (10000 square meters). Use a unit scale factor of area of 100 (100 by 100 meters is one hectare).

 Map units are feet, and it is desired to calculate density as per square mile. Use a unit scale factor for area of 5280 (the number of feet in a mile).

The table below gives approximate values of the unit scale factor of area to use for some common conversions.

Input map units	Output density per	Unit scale factor

feet	square foot	1

feet	square meter	3.208

feet	acre	5280

feet	hectare	328.083

feet	1000 square feet	31.623

meters	square foot	0.3048

meters	square meter	1

meters	acre	1609.3

meters	hectare	100

meters	1000 square feet	9.639

It is often desirable to use a unit scale factor of area larger than 1. Otherwise, density values calculated per square foot or meter may be very small. If the output Grid appears to have all 0 values, try using a larger unit scale factor of area.

References

Silverman, B.W. Density Estimation for Statistics and Data Analysis. New York: Chapman and Hall, 1986.


Grid MakeFromFTab Discussion
MakeFromFTab Discussion

Any type of FTab created from any type of source file can be converted to a Grid. It doesn’t matter if the source data for a FTab comes from a CAD drawing, ARC/INFO coverage, or shapefile; it can be converted to a Grid. If you wish to convert a DBTheme to a Grid, you must first convert the selected features to a FTab with aDBTheme.ExportToFTab.

When polygon shapes are converted, the center of the cell is used to find a polygon value for that cell.

When line shapes are converted, cells are given the value of the line that intersects each cell. Cells that are not intersected by a line are given the value of No Data. If more than one line is found in a cell, then the cell is arbitrarily given the value of one of the lines.

When point shapes are converted, cells are given the value of the point found within each cell. Cells that don't contain a point are given the value of No Data. If more than one point is found in a cell, then the cell is arbitrarily given the value of one of the points.

If you wish to have more control over which polygon, line, or point value is given to each cell, then you should use a cell size that is smaller than normally needed during conversion. The request aGrid.Aggregate can then be used to create a Grid with the desired cell size with more control over which polygon, line, or point value is used for that cell. The requests anFTab.FocalStats and Grid.MakeFromPointStats are alternative ways to convert a point FTab to Grid.

You can convert an FTab using both string and numeric Fields. If you use a string Field, then each unique string in the FTab is assigned a unique value in the output Grid. A Field named "S_Value" is added to the VTab of the output Grid to hold the original string value from the FTab.


Grid MakeFromFTab Example
MakeFromFTab Example

The following example converts a FTheme to a GTheme. Every cell that is intersected or contained within a feature is given the value of 1. You can also pass a Field to the Grid.MakeFromFTab request that will give values to cells. If the AnalysisEnvironment extent and cell size are set to explicit values, then these values are used during the conversion. If they are not, then the user is prompted with a dialog for values for the extent and cell size. The example assumes that the only active Theme is a FTheme.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

'set extent and cell size for conversion if not already set

theAE = theView.GetExtension(AnalysisEnvironment)

theExtent = Rect.Make(0@0,1@1)

theCellSize = 1

if ((theAE.GetExtent(theExtent) <> #ANALYSISENV_VALUE) or

    (theAE.GetCellSize(theCellSize) <> #ANALYSISENV_VALUE)) then

  theCE = AnalysisPropertiesDialog.Show(theView,TRUE,"Conversion Extent")

  ' check for Cancel from dialog

  if (theCE = NIL) then

    return NIL

  end

  theCE.GetCellSize(theCellSize)

  theCE.GetExtent(theExtent)

end

' actually do conversion

aPrj = theView.GetProjection

aGrid = Grid.MakeFromFTab(theTheme.GetFTab,aPrj,NIL,{theCellSize,theExtent})

theGTheme = GTheme.Make(aGrid)

if (aGrid.HasError) then

  return NIL

end

theView.AddTheme(theGTheme)


Grid MakeFromPointStats Discussion
MakeFromPointStats Discussion

The Grid.MakeFromPointStats request calculates statistics on point features that fall in the neighborhood around each output Grid cell. It is similar to the focal or neighborhood functions in that the neighborhoods overlap. The Grid.MakeFromPointStats request differs from focal functions since it operates directly on points instead of on a Grid. One of the advantages of operating directly on points is that points are not lost in converting to a Grid if they are too close together.


Grid Merge Example
Merge Example

The following code fragment merges several Grids. The order in which the Grids are placed into the List is important.

theGridList = {bGrid, cGrid, dGrid)

outGrid = aGrid.Merge(theGridList)

In areas of overlap, cells with values other than No Data for aGrid are used over the values in the other Grids. If the value of aGrid is No Data, then the value of bGrid is used, unless it is No Data, in which case the value of cGrid is used, and so on. If you wanted the values of bGrid to be used first, then the values of cGrid, followed by aGrid, and lastly dGrid, you would change the above fragment to the one below.

theGridList = {cGrid, aGrid, dGrid}

outGrid = bGrid.Merge(theGridList)


Grid Mosaic Discussion
Mosaic Discussion

The aGrid.Mosaic request creates one Grid from two or more adjacent Grids and makes a smooth transition over the overlapping areas of the neighboring Grids.

Notes

 The aGrid.Mosaic request can be very useful when a set of adjacent Grids needs to be merged into one entity but also when it is desired to minimize the abrupt changes along the boundaries of the overlapping Grids.

 The aGrid.Mosaic request is designed primarily for the continuous data. That is, due to the nature of mosaicing, the appropriate results over the overlapping areas can be expected only for continuous types of data, such as the spatially adjacent Grids representing Digital Elevation Models, satellite images acquired in a slightly different time, containment plumes, etc.

 Both, integer and floating point type of Grids can be entered as input. The output Grid will be a floating point Grid unless all of the member Grids are of the integer type.

 For the floating point input Grids of different resolution it is recommended to resample all the data using bilinear interpolation or cubic convolution with the aGrid.Resample request before using the aGrid.Mosaic request. Otherwise, the aGrid.Mosaic request will automatically resample the Grids using nearest neighbor (which is not appropriate for continuous data) using the current cell size setting of the AnalysisEnvironment and then perform mosaicking. The default cell size is set to the coarsest resolution of all inputs. With that unchanged, the request will resample the finer Grid(s) to the coarsest resolution.

 The maximum number of Grids that can be opened simultaneously in is 50. Therefore, the maximum number of Grids entered into the Mosaic request is restricted to 49 (which includes 49 input Grids and 1 output Grid), 48 if a mask Grid has been identified, 1024 characters (including commas) on the input string, and the number of files that the Operating System can have open at one time.

Discussion

The aGrid.Mosaic request works similarly to the aGrid.Merge request. When the Grids to be put together do not have any overlapping area, there is no difference in the output from both functions. The difference is the processing of the overlapping areas. In case of the aGrid.Merge request, the sequence of input Grids determines the values assigned to cells over the common map extent, giving priority to those entered first.

For the aGrid.Mosaic request, the sequence of entry is irrelevant if on each overlapping area no more than two Grids intersect. It uses a weighted average method to calculate values of cells in the overlapping area, taking input from two or more input Grids.

For the purpose of explanation, each one of the two Grids used in the following example represents a discrete type of data which in general is not applicable for mosaicking. The input Grids have different map extents, one is shifted versus the other for one column, with the five columns being common for both. The one called inGrid2 is a floating point Grid while the other one is an integer Grid.

If the input Grids are integer data, the output Grid will also be integer and the values of the output Grid will be truncated.

References

Franke, R. (1982). Smooth Interpolation of Scattered Data by Local Thin Plate Splines. Comp. & Maths with Appls. Vol. 8, No. 4, pp. 273 - 281. Pergamon Press Ltd.


Grid PointValue Discussion
PointValue Discussion

The interpolated value for aPoint is derived by interpolating from the 4 nearest cell centers. First 2 lines are interpolated between the cell centers in the Y or column direction. Then a line is interpolated from these 2 lines in the X or row direction that intersects aPoint. Finally aPoint's elevation is interpolated from this line. All interpolations are linear.


Grid ReclassByClassList Example
ReclassByClassList Example

The following example reclassifies a GTheme using the Classifications found in its Legend. A unique value is given to the new GTheme for each class in the Legend of the original GTheme.

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

theLegend = theTheme.GetLegend

theGrid = theTheme.GetGrid

theField = theLegend.GetFieldNames.Get(theLegend.GetFieldNames.Count - 1)

aClassList = theLegend.GetClassifications

' the list of classifications and each classification needs to

' be cloned so that the labels in the original legend do not change

theClassList = aClassList.DeepClone

count = 1

for each c in theClassList

  c.SetLabel(count.AsString)

  count = count + 1

end

theResultGrid = theGrid.ReclassByClassList(theField,theClassList,FALSE)

theResultTheme = GTheme.Make(theResultGrid)

theView.AddTheme(theResultTheme)


Grid Resample Discussion
Resample Discussion

The aGridResTypEnum enumeration, #GRID_RESTYPE_NEAREST, performs a nearest-neighbor assignment and is the fastest of the 3 interpolation methods. It is used primarily for categorical data such as a land use classification, since it will not change the values of the cells. The maximum spatial error will be one half the cell size.

The aGridResTypEnum enumeration, #GRID_RESTYPE_BILINEAR, performs a bilinear interpolation and determines the new value of a cell based upon a weighted distance average of the four nearest input cell centers. It is useful for continuous data, and will cause some smoothing of the data.

The aGridResTypEnum enumeration, #GRID_RESTYPE_CUBIC, performs a cubic convolution and determines the new value of a cell based upon a weighted distance average of the sixteen nearest input cell centers. It is appropriate for continuous data. It is geometrically less distorted than the Grid achieved by running the  #GRID_RESTYPE_NEAREST enumeration. The disadvantage of the #GRID_RESTYPE_CUBIC enumeration, is that it requires more processing time.

Notes

 The #GRID_RESTYPE_BILINEAR and #GRID_RESTYPE_CUBIC enumerations should not be used with categorical data, since the cell values may be altered.

 The lower-left corner of the output Grid will be the same map space coordinate location as the lower-left corner of the input Grid.

 The numbers of rows and columns in the output Grid are determined as follows:

# columns = (xmax - xmin) / cell size

# rows = (ymax - ymin) / cell size

 If there is any remainder from the above equations, then rounding of the number of columns and/or rows is performed.


Grid ReturnContour Example
ReturnContour Example

The following example creates a Graphic line of a contour passing through a point specified with the cursor on the active View. The contour is created from an active GTheme. The value of the contour is displayed in the status bar. The example must be executed from an Apply event since it uses ReturnUserPoint to get the point. It also assumes that there is only one Theme active and that it is a GTheme.

theView = av.GetActiveDoc

theGridTheme = theView.GetActiveThemes.Get(0)

thePoint = theView.GetDisplay.ReturnUserPoint

zValue = 0

aPrj = Prj.MakeNull

theLine = theGridTheme.GetGrid.ReturnContour(thePoint, zValue, aPrj)

theGraphicLine = GraphicShape.Make(theLine)

theView.GetGraphics.Add(theGraphicLine)

av.ShowMsg("Contour Value : "++zValue.AsString)


Grid ReturnCostPath Example
ReturnCostPath Example

The following example uses an elevation and a flow direction GTheme to trace the flow of a raindrop with the request aGrid.ReturnCostPath. From a click on the display the path of a raindrop is traced on the View as a Graphic. The example assumes that the only active Theme is the elevation GTheme and that the View contains a GTheme with the name "Flow Direction". The example must be executed from an Apply event since it uses ReturnUserPoint to get the point.

theView = av.GetActiveDoc

theDisplay = theView.GetDisplay

theTheme = theView.GetActiveThemes.Get(0)

thePoint = theDisplay.ReturnUserPoint

theFlowDirGrid = theView.FindTheme("Flow Direction").GetGrid

theLine = theTheme.GetGrid.ReturnCostPath(theFlowDirGrid,thePoint)

theGraphicLine = GraphicShape.Make(theLine)

theView.GetGraphics.Add(theGraphicLine)


Grid SetNull Example
SetNull Example

The value of No Data is not a number that you can access. If you need to set a cell value to No Data, then the aGrid.SetNull request is used. The line of code below converts cells with a value of 4 to No Data.

outGrid = (inGrid = 4.AsGrid).SetNull(inGrid)


Grid Sink Discussion
Sink Discussion

The aGrid.Sink request creates a Grid identifying all sinks, or areas of internal drainage.

The output is an integer Grid with each sink being assigned a unique value. Sinks are numbered between 1 and the number of sinks.

Discussion

A sink is a cell or set of spatially connected cells whose flow direction cannot be assigned one of the eight valid values in a flow direction Grid. This can occur when all neighboring cells are higher than the processing cell, or when two cells flow into each other creating a two-cell loop.

Sinks are considered to have undefined flow directions and are assigned a value that is the sum of their possible directions. For example, if the steepest drop, and therefore flow direction, is the same both to the right (1) and left (16), the value 17 would be assigned as the flow direction for that cell.

To create an accurate representation of flow direction and therefore accumulated flow, it is best to use a data set that is free of sinks. A digital elevation model that has been processed to remove all sinks is referred to as a depressionless DEM.

Sinks in elevation data are most commonly due to errors in the data. These errors are often due to sampling effects and the rounding of elevations to integer numbers. Naturally-occurring sinks in elevation data with a cell size of 10 meters or larger are rare (Mark, 1988) except for glacial or karst areas, and generally can be considered errors. As the cell size increases, the number of sinks in a data set often also increases.

The identification and removal of sinks, when trying to create a depressionless DEM, is an iterative process. When a sink is filled, the boundaries of the filled area may create new sinks which then need to be filled. The demfill sample script shows how to create a depressionless DEM.

References

Mark, D. M. 1988. ‘Network Models in Geomorphology’, Modeling in Geomorphologic Systems. John Wiley.


Grid Slope Discussion
Slope Discussion

Slope identifies the maximum rate of change in value from each cell to its neighbors. An output slope Grid can be calculated as percent slope or degree of slope.

Conceptually, the aGrid.Slope request fits a plane to the z values of a 3x3 cell neighborhood around the processing or center cell. The direction the plane faces is the aspect for the processing cell. The slope for the cell is calculated from the 3x3 neighborhood using the average maximum technique (see references).

The actual algorithm that is used to calculate slope is:

rise_run = SQRT(SQR(dz/dx)+SQR(dz/dy))

degree_slope = ATAN(rise_run) * 57.29578

where the deltas are calculated using a 3x3 roving window, where a through i represent the values in the window:

a b c

d e f

g h I

(dz/dx) = ((a + 2d + g) - (c + 2f + i)) / (8 * x_mesh_spacing)

(dz/dy) = ((a + 2b + c) - (g + 2h + i)) / (8 * y_mesh_spacing)

The use of a zFactor is essential for correct slope calculations when the surface z-units are expressed in units which are different from the ground units. Degree of slope is a value between 0 and 90.

If the center cell in the immediate neighborhood (3x3 window) is No Data, the output is No Data. If any neighborhood cells are No Data, they are assigned the value of the center cell when the slope is computed. The result is a flattening of the 3x3 plane that is fit to these cells (especially at the edge of the Grid), which leads to a reduction in the slope.

References

Burrough, P.A., (1986). Principles of Geographical Information Systems for Land Resources Assessment. Oxford University Press, New York, p. 50.


Grid SnapPourPoint Discussion
SnapPourPoint Discussion

The aGrid.SnapPourPoint request snaps pour points to the cell of highest flow accumulation within a specified snapDistance.

It is used to ensure points of high accumulated flow when delineating drainage basins using the aGrid.Watershed request. The aGrid.SnapPourPoint request will search within snapDistance around each pour point for the cell of highest accumulated flow, and move the pour point to that location.


Grid StreamLink Discussion
StreamLink Discussion

The aGrid.StreamLink request assigns unique values to sections of a raster linear network between intersections.

The input Grid must be a raster linear network, which can be created by thresholding the results of the aGrid.FlowAccumulation request. The raster linear network should be represented as values greater than or equal to one on a background of No Data.

Links are the sections of a stream channel connecting two successive junctions, a junction and the outlet, or a junction and the drainage divide.

The result of the aGrid.StreamLink request can be used as the source Grid of the aGrid.Watershed request to create drainage basins that correspond the branches of a stream network.


Grid StreamOrder Discussion
StreamOrder Discussion

The aGrid.StreamOrder request assigns a numeric order to segments of aGrid, which represent branches of a raster linear network. It is most commonly used in hydrology.

aGrid must be a raster linear network. The raster linear network should be represented as values greater than or equal to one on a background of No Data.

This Grid can be created by thresholding the results of the aGrid.FlowAccumulation request.

If shreveMethod is TRUE, the method of stream ordering will use a method of stream ordering by magnitude proposed by Shreve in 1967. All links with no tributaries are assigned a magnitude (order) of 1. Magnitudes are additive downslope. When two links intersect, their magnitudes are added and assigned to the downslope link.

If shreveMethod is FALSE, the method of stream ordering is that proposed by Strahler in 1952. Stream order only increases when streams of the same order intersect. Therefore the intersection of a first order and second order link will remain a second order link rather than create a third order link. When two first order links intersect, the downslope link is assigned an order of 2. When two second order links intersect, the downslope link is assigned an order of 3, and so on.


Grid Verify Example
Verify Example

The following code fragment shows how the Grid.SetVerify and Grid.GetVerify requests can be used to control the overwriting of grid data sets. The request SourceManager.PutDataSet prompts the user with a dialog for a new name for a grid data set. If the data set exists the dialog asks if the user wants to overwrite the existing data set. If the user answers no, then they are allowed to pick another name. If they answer yes the dialog returns the FileName. To prevent the Spatial Analyst for asking if the user wants to overwrite the data set again, the current verify status is stored by returning it with the Grid.GetVerify request, then the verify status is turned off with the Grid.SetVerify request, and the data set is overwritten. After the data set is written to disk the verify status is return to the state that was previously set with the Grid.SetVerify request and the stored setting.

aFN = SourceManager.PutDataSet(GRID,"New grid data set name",TRUE)

' check for Cancel from dialog

if (aFN = NIL) then

  return NIL

end

theStatus = Grid.GetVerify

Grid.SetVerify(#GRID_VERIFY_OFF)

if (aGrid.SaveDataSet(aFN).Not) then

  Grid.SetVerify(theStatus)

  return NIL

end

Grid.SetVerify(theStatus)


Grid Visibility Discussion
Visibility Discussion

The aGrid.Visibility request analyzes visual exposure and performs viewshed analysis. Here are some examples of the types of questions that can be answered with Visibility:

 Which areas can be seen from a fire lookout tower that is 15 meters high? (Options: Input point FTab, cellObserved set to FALSE, OFFSETA)

 How frequently can a proposed disposal site be seen from an existing highway? (Options: Input line FTab, cellObserved set to FALSE)

 Where should the next communications repeater tower in a series be located? (Options: Input point FTab, cellObserved set to FALSE, OFFSETA, OFFSETB, VERT1, VERT2, AZIMUTH1, AZIMUTH2)

 Given a set of locations for fire lookout towers, what is the minimum number of towers required to see the entire study area? (Options: Input point FTab, OFFSETA, cellObserved set to TRUE)

 Which locations of the Grid can see only the disposal site and transmission tower 3? (Options: Input point FTab, cellObserved set to TRUE)

 How can I determine which surface locations have the best view? I want to assign different weights to each landscape feature within a viewshed based on its visual quality. (Options: Input point FTab, cellObserved set to TRUE)

When a line FTab is used, every node and vertex along each input line is processed as an individual observation point. When the cellObserved is set to FALSE, the values in the Value Field of the output Grid's VTab contain the number of nodes and vertices that are visible from each cell.

No Data cells between the point of observation and other cells are evaluated as invisible, and do not obscure visibility.

Controlling the visibility analysis

It is possible to limit the region of the Grid inspected by specifying any of the optional Fields described below. You can specify observation point elevation values, vertical offsets, horizontal and vertical scanning angles, and scanning distances.

Nine Fields in the input FTab can be used to control the visibility analysis. These Fields are SPOT, OFFSETA, OFFSETB, AZIMUTH1, AZIMUTH2, VERT1, VERT2, RADIUS1 and RADIUS2.

With a point FTab, each observation point can have a unique set of observation constraints. With a line FTab, every vertex along an input line uses the same observation constraints.

The optional Fields in the input FTab must be numeric. Whenever a Field does not exist, the default values are applied.

The SPOT Field specifies surface elevations for the observation points or vertices. When a Field named SPOT exists in the FTab, the SPOT values are used as the elevation of the observation points. If no SPOT Field is present, the surface elevation for the observation points is interpolated from the input Grid using bilinear interpolation. An elevation will not be able to be determined if the nearest Grid cell to an observation point or vertex is No Data. In this case, the observation point is excluded from the visibility analysis.

The OFFSETA Field indicates a vertical distance in surface units to be added to the z value of the observation point. If OFFSETA exists in the FTab, its value is added to the SPOT elevation when present, otherwise to the interpolated surface z value. The OFFSETA value must be positive. If the OFFSETA Field does not exist, the default value is 1.

The OFFSETB Field indicates a vertical distance in surface units to be added to the z value of each cell as it is considered for visibility.  If OFFSETB exists in the FTab, its value is added to the surface z value of each cell location when it is being analyzed for visibility. The value must be positive. If no OFFSETB Field is found in the FTab, it defaults to zero.

The AZIMUTH1 and AZIMUTH2 Fields specify horizontal angle limits to the scan. The sweep proceeds in a clockwise direction from AZIMUTH1 to AZIMUTH2. Values are given in degrees from 0 to 360, with 0 oriented to the north. If the AZIMUTH1 and AZIMUTH2 Fields do not exist in the FTab, AZIMUTH1 defaults to 0 and AZIMUTH2 defaults to 360, implementing a full 360-degree sweep.

The VERT1 and VERT2 Fields specify vertical angle limits to the scan. The value of VERT1 sets the upper limit of the scan; VERT2 sets the lower limit. The VERT1 and VERT2 angles are expressed in degrees between 90 and -90 degrees. Positive angles are above the horizontal plane; negative angles are below. The horizontal plane (0 degrees) is defined by the z value of the observation point plus the value of OFFSETA. The default values are 90 for VERT1 and -90 for VERT2.

The RADIUS1 and RADIUS2 Fields limit the search distance when identifying areas visible from each observation point. Cells beyond the RADIUS2 search distance are excluded from the analysis. Cells closer than the RADIUS1 search distance are not visible in output Grid but can still block the visibility of cells between RADIUS1 and RADIUS2. The default RADIUS1 distance is zero. The default RADIUS2 distance is infinity.

By default, the limiting distances RADIUS1 and RADIUS2 are interpreted as three-dimensional line-of-sight distances. To ensure that the slope distance is calculated correctly, both the ground units and surface z-units must be in the same unit of measure. To process RADIUS1 and RADIUS2 as two-dimensional planimetric distances, insert a negative sign (-) in front of the values. For example, if RADIUS1 is set to -1000 and RADIUS2 is set to -9000, Visibility analyzes the regions of the surface between 1,000 and 9,000 ground units measured planimetrically from the observer.

The Frequency option: cellObserved set to FALSE

With the Frequency option, the aGrid.Visibility request creates a Grid recording the number of times each area can be seen from the observation points. This value is recorded in the Value Field in the VTab of the output Grid.

The Observers option: cellObserved set to TRUE

In addition to the standard Fields Value and Count in the VTab of the output Grid, new Fields are created corresponding to each observer in the input point FTab. The Fields are named OBS1, ...OBSn, where n is the number of observers.

These Fields record the visibility of each cell by every observer. For example, every Grid cell that can be seen by observer 8 will contain a value of 1 in the Field named OBS8. Cells that cannot be seen by the observation point are assigned a value of 0. Cell locations assigned No Data on the input Grid are assigned No Data on the output Grid.

You can use the OBS Fields to identify those Grid cells that can be seen from a specific observation point. This is slightly different than the previous case where we made a selection based on the Value Field. In this case, cells that can be seen by observers 1 and 8 may also be seen by other observers.

For example, to display all areas that can be seen by observation points 1 and 8, perform a table selection on the resulting visibility Grid (after making it a GTheme).

Quantifying visual quality

The Observers (cellObserved set to TRUE) information can also be used to perform an analysis of visual quality. For example, you can determine the visual quality of all locations on a surface by positioning an observation point at each significant visual feature within the input Grid’s extent. Such points might include the city dump, the auto salvage yard, the local parks and each of the power transmission towers in the region.

After running the aGrid.Visibility request with the Observers option, use the OBSn Field in the output Grid’s VAT to select those cell locations that can see each visual feature. Use any of a variety of the Spatial Analyst functions to accumulate positive or negative scores depending on each observation point’s visual quality and weight. After all observation points have been considered, those cell locations with the best scores will have the best visual quality.

Additional Notes

Determining visibility is a computer-intensive process. The processing time is highly dependent on the Grid resolution. For the purposes of preliminary studies, you may want to set the analysis cell size to a coarser resolution.

The Observers option (the cellObserved set to TRUE) is only available with an input point FTab and when the number of observation points is 16 or less; there is no limit to the number of observation points with the Frequency option (the cellObserved is set to FALSE).


Grid Visibility Example
Visibility Example

The following example finds all areas on a surface that can be seen from points in a point Theme and presents it as a GTheme. It assumes that only a single point Theme is active and that the View contains a surface GTheme named "Elevgrd".

theView = av.GetActiveDoc

theTheme = theView.GetActiveThemes.Get(0)

theFTab = theTheme.GetFTab

theGrid = theView.FindTheme("Elevgrd").GetGrid

thePrj = theView.GetProjection

theResult = theGrid.Visibility(theFTab,thePrj,FALSE)

theGTheme = GTheme.Make(theResult)

' check for error during operation

if (theResult.HasError) then

  return NIL

end

theView.AddTheme(theGTheme)


Grid Warp Discussion
Warp Discussion

It is necessary when performing spatial analysis to have all data sources registered to a common coordinate system. A coordinate system is defined by a map projection and its parameters, and its units of measure.

Each Grid exists in an x,y coordinate system. A set of Grids in a common coordinate system based on a defined map projection are said to be geo-referenced. One process for transforming a Grid from one x,y coordinate system to another is referred to as rubber sheeting.

In order to transform a Grid from one coordinate system to another or to correct for spatial errors, it is necessary to create links that specify the input and output coordinates for a set of control points on the Grid.

The aGrid.Warp request transforms all cells in a Grid according to a polynomial transformation, trying to achieve the best overall fit. The control points are also affected by the polynomial formula, and may not be positioned exactly as specified by the link List. Warping is most appropriate for large changes in coordinate values, such as transforming a Grid from row-column space to real-world coordinates.

Locations that can be easily found and precisely located are usually chosen as control points. These may include road and stream intersections, building corners, bridges, the mouth of a stream, rock outcrops, and identifiable points on geometric landscape features such as the end of a jetty of land, the corner of an established field, and the intersection of two hedge rows.

When the aCellSize is NIL, the aGrid.Warp request will determine the extent of the warped Grid and will set the number of rows and columns to be about the same as in the input Grid. Some minor differences may be due to the changed proportion between the output Grid sizes in the X and Y directions. The default cell size is computed by dividing the map extent by the previously determined number of rows and columns. The value of the cell size is used by the resampling algorithm. If the user defines a value for aCellSize, the number of rows and columns are calculated as follows:

#columns = (xmax - xmin) / cell size

#rows = (ymax - ymin) / cell size

Warp is useful when the Grid requires a systematic geometric correction that can be modeled with a polynomial. A spatial transformation can invert or remove a distortion by using polynomial transformation of the proper order. The higher the anOrder argument, the more complex the distortion that can be corrected. However, it is usually not necessary to use anOrder higher than 3. The higher orders of polynomial will involve progressively more processing time.

To determine the minimum number of links necessary for a given order of polynomial, use the following formula:

n = (p + 1) (p + 2) / 2

where n is the minimum number of links required for a transformation of polynomial order p. It is strongly suggested to use more links than the minimum number.

The aGridResTypeEnum argument defines the resampling technique that is used in the warping process. The options are nearest neighbor assignment, bilinear interpolation, or cubic convolution. For more information on resampling techniques see the Discussion topic for the aGrid.Resample request.


Grid Warp Example
Warp Example

The following code fragment uses the aGrid.Warp request to georeference a Grid to a UTM coordinate system using a second order polynomial and bilinear resampling.

linkOne = Line.Make(9@7,1694540@267151)

linkTwo = Line.Make(489@535,1714015@286044)

linkThree = Line.Make(528@18,1714693@267442)

linkFour = Line.Make(2@477,1694928@286432)

linkFive = Line.Make(102@299,1704098@283549)

linkSix = Line.Make(333@89,1709044@271215)

theLinkList = {linkOne,linkTwo,linkThree,linkFour,linkFive,linkSix}

theResult = theGrid.Warp(theLinkList,2,#GRID_RESTYPE_BILINEAR,NIL)


Grid Watershed Discussion
Watershed Discussion

The aGrid.Watershed request determines the contributing area above a set of cells in a Grid.

Notes

 The value of each watershed will be taken from the value of the source cell in the source Grid.

 By using the elevation Grid as input to the aGrid.ExtractByPoints request, the value of the resulting watersheds will be equal to the elevation of the pour point of each watershed.

 the source Grid can be a Grid of point locations, an interactively selected point, or the output from aGrid.StreamLink request.

Discussion

A watershed is an area that drains water and other substances to a common outlet as concentrated drainage. Other common terms for a watershed are: basin, catchment , or contributing area. This area is normally defined as the total area flowing to a given outlet, or pour point. These areas are the output of the aGrid.Watershed request. The boundary between two watersheds is referred to as a watershed boundary or drainage divide.

An outlet, or pour point is the point at which water flows out of an area. This is the lowest point along the boundary of the watershed. The cells in the source Grid are used as pour points above which the contributing area is determined. Source cells may be features such as dams or stream gauges, for which you want to determine characteristics of the contributing area.


Grid ZonalFill Discussion
ZonalFill Discussion

The aGrid.ZonalFill request fills zones using the minimum cell value from a weight Grid, along the zone boundary. It can be used to fill sinks or depressions in a digital elevation model to the minimum elevation of their watershed boundary. This is a step in determining the depth of sinks before filling to create a depressionless DEM. This is demonstrated in the demfill sample script.


Grid ZonalGeometry Discussion
ZonalGeometry / ZonalGeometryTable Discussion

These requests calculate for each zone of the input Grid its area, perimeter, thickness, and the characteristics of an ellipse fit to the zone. Zones do not have to be connected.

Area

Calculates the area of each zone in the input Grid. The area of a zone is the sum of the cells that create the zone times the cell size. The area for each disconnected region is added and only one area is assigned to the zone.

Perimeter

The perimeter of a zone is the sum of the lengths of the boundaries of each connected region in the zone. Both external boundaries and internal boundaries (islands) are taken into account. If a zone is not connected, the perimeter for each disconnected region is added and only one perimeter is assigned to the zone.

Thickness

Calculates for each zone on an input Grid the deepest or thickest point within the zone from its surrounding cells. Thickness can be used for data cleanup to remove small or thin zones that might be noise in the data or irrelevant information for analysis. If one or more boundaries of a zone border the extent of the Grid, the borders will be ignored in the calculations. The thickness is only determined to cells inside the extent of the Grid. No Data values inside the extent of the Grid are valid cells which the thickness will be calculated to, but no thickness will calculated for No Data cells.

Thickness calculates the radius (in cells) of the largest circle that can be drawn within each zone without including any cells outside the zone. The computation is calculated from the center of the cells internal to the zone to the edge or closest border of an external cell (not to the center of the external cell). The border can be an outside border or an inside border created by an island in the zone.

The distance between two adjacent cells that are either directly horizontal or vertical from one another and internal to the zone is one times the cell size. If two adjacent cells internal to the zone are diagonal from one another, the distance is 1.414214 times the cell size. At the border of the zone, when a cell within the zone comes in contact with a cell outside the zone, the same two formulas above are used except they are divided by two. The distance from the internal cells to a border is accumulative.

Conceptually, each zone is visited and the distance of all the edge cells of the zone to its border is calculated. Then the distance of the next internal row or ring is calculated, and the next, and so forth, until there are no more cells within the zone.

Centroid

Canonical analysis is used to determine the parameters of ellipses describing all zones. The area of each ellipse is equal to the area of the zone to which it is assigned. The center of the ellipse is located at the centroid of the zone. The coordinates of each ellipse are stored in the Fields XCENTROID and YCENTROID. The shape of the ellipse is the best ellipsoidal approximation of the zone’s figure. The parameters defining the shape and the size of the ellipse are stored with the Fields MAJORAXIS and MINORAXIS showing the lengths of ellipse’s axis.

All the results are presented in map units. Only the values of the ORIENTATION Field are in degrees with the possible range from 0 to180. The ORIENTATION is defined as an angle between the X axis and the major axis of the ellipse. The values of the orientation angle increase in a counterclockwise direction starting from 0 in the east (horizontal, to the right) and going through 90 when the major axis is vertical.

If a particular zone consists of only one cell or if the zone is a single square block of cells then the ORIENTATION of the ellipse (being a circle in this case) is set to 45 degrees.


Grid ZonalStats Example
ZonalStatsTable / ZonalStats Example

The following example creates a Table that summarizes the cell values in a population density GTheme for each zone found in a FTheme. It assumes that the only active Theme is a FTheme that contains the Field "Id". It also assumes that the active View contains a GTheme with the name of "Popden".

theView = av.GetActiveDoc

' get zone theme

zoneTheme = theView.GetActiveThemes.Get(0)

zoneObj = zoneTheme.GetFTab

'get zone Field from zoneObj

zoneField = zoneObj.FindField("Id")

' get value theme

valueTheme = theView.FindTheme("Popden")

' obtain grid from value theme and create VTab

theGrid = valueTheme.GetGrid

aPrj = theView.GetProjection

aFN = "c:\temp\zstat.dbf".AsFileName

theVTab = theGrid.ZonalStatsTable(zoneObj,aPrj,zoneField,FALSE,aFN)

' check for error during operation

if (theVTab.HasError) then

  return NIL

end

zoneTable = Table.Make(theVTab)

zoneTable.GetWin.Activate

You can also output a GTheme that contains the value of one statistics for the cell values found in each zone of a FTheme. The output GTheme will have the same value for each cell used to calculate the statistic for a zone. In the example below you will get a GTheme that contains the mean population density value for each zone. Each cell value in a zone will contain the mean population density for that zone. It assumes that the only active Theme is a FTheme that contains the Field "Id". It also assumes that the active View contains a GTheme with the name of "Popden".

theView = av.GetActiveDoc

' get zone theme

zoneTheme = theView.GetActiveThemes.Get(0)

zoneObj = zoneTheme.GetFTab

'get zone Field from zoneObj

zoneField = zoneObj.FindField("Id")

' get value theme

valueTheme = theView.FindTheme("Popden")

' obtain grid from value theme and create VTab

theGrid = valueTheme.GetGrid

aPrj = theView.GetProjection

theResultGrid = theGrid.ZonalStats(#GRID_STATYPE_MEAN,zoneObj,aPrj,zoneField,FALSE)

theGTheme = GTheme.Make(theResultGrid)

' check for error during operation

if (theResultGrid.HasError) then

  return NIL

end

theView.AddTheme(theGTheme)


GTheme Expression Example
HasExpression / EditExpression Example

The following example brings up either the Map Query or Map Calculator dialog for a GTheme that was originally created by one of these dialogs. The expression that originally created the GTheme is shown in the dialog. The requests aGTheme.HasExpression and aGTheme.EditExpression are used to loop through each active Theme to only bring up the dialog if the active Theme is a GTheme with an expression.

theView = av.GetActiveDoc

' bring up Map Query or Map Calculator dialog for each

' grid theme that contains an expression

for each t in theView.GetActiveThemes

  if (t.Is(GTHEME)) then

    ' does the grid theme have an expression

    if (t.HasExpression) then

      ' bring up dialog with previous expression set

      t.EditExpression

    end

  end

end


GTheme GetGrid Example
GetGrid Example

The Grid class contains most of the analysis requests for the Spatial Analyst, while the GTheme class displays the contents of a Grid. Scripts written to perform analysis from a View will most likely need to get the Grid from a GTheme to perform the analysis. The following example loops through all of the active Themes and displays the SrcName of the Grid of the active GThemes. It could just as easily run the aGrid.Sin request or any other analysis request on the Grid of the active GThemes.

theView = av.GetActiveDoc

' display the source name of the grid for each grid theme

for each t in theView.GetActiveThemes

  if (t.Is(GTHEME)) then

    ' get grid and display source name

    theGrid = t.GetGrid

    MsgBox.Info(theGrid.GetSrcName.AsString,"The source name of the grid")

  end

end


GTheme Histogram Example
Histogram Example

The following example creates a histogram Chart for each active GTheme found in a View. If there are any selected Graphics in the View, then only those cells in the GTheme that are intersected by or contained within the selected Graphics are used to create the histogram.

theView = av.GetActiveDoc

' create histogram for each active GTheme

for each t in theView.GetActiveThemes

  if (t.Is(GTHEME).Not) then

    continue

  end

  ' create histogram

  theChart = t.Histogram(TRUE,NIL,TRUE)

  theChart.GetWin.Activate

end


GTheme ZoneHistogram Example
ZoneHistogram Example

The following example creates a Chart that has a separate histogram of a population density GTheme for each zone in the active FTheme. Each histogram in the Chart is created from those cells that are intersected by or contained within the features of each zone. It assumes that the only active Theme is a FTheme that contains the Field "Id". It also assumes that the active View contains a GTheme with the name of "Popden".

theView = av.GetActiveDoc

' obtain theme defining zones

zoneTheme = theView.GetActiveThemes.Get(0)

zoneField = zoneTheme.GetFTab.FindField("Id")

' obtain theme containing values to chart

valueTheme = theView.FindTheme("Popden")

' create histogram chart

theChart = valueTheme.ZoneHistogram(TRUE,NIL,zoneTheme,zoneField)

theChart.GetWin.Activate


Hydro Example
Hydrologic Modeling Example

The following code fragment shows a process of delineating watersheds from an elevation data set automatically. The elevation data should be free of sinks. The size of the watersheds returned is controlled by the number of cells that need to flow into a cell to classify it as a stream. If you wanted to create smaller watersheds, then you could decrease this number in the aGrid.SetNull request that creates streamGrid. Larger watersheds are achieved by increasing this number.

' calculate flow direction

flowDirGrid = elevGrid.FlowDirection(FALSE)

' calculate flow accumulation

flowAccGrid = flowDirGrid.FlowAccumulation(NIL)

' extract streams from flow accumulation

streamGrid = (flowAccGrid < 600.AsGrid).SetNull(1.AsGrid)

' delineate stream links

streamLinkGrid = streamGrid.StreamLink(flowDirGrid)

' delineate watersheds for each stream link

watershedGrid = flowDirGrid.Watershed(streamLinkGrid)

The following example creates a watershed based on a point that is specified with a cursor in the view. The watershed is presented as a new GTheme in the View. It assumes that there is a single elevation GTheme active, and that the View contains a flow direction GTheme named "Flow Direction" and a flow accumulation GTheme named "Flow Accumulation". The example must be executed from an Apply event since it uses ReturnUserPoint to get the point.

theView = av.GetActiveDoc

theDisplay = theView.GetDisplay

theGridTheme = theView.GetActiveThemes.Get(0)

theGrid = theGridTheme.GetGrid

thePoint = theDisplay.ReturnUserPoint

mPoint = MultiPoint.Make({thePoint})

theSrcGrid = theGrid.ExtractByPoints(mPoint,Prj.MakeNull,FALSE)

theFlowDir = theView.FindTheme("Flow Direction").GetGrid

theAccum = theView.FindTheme("Flow Accumulation").GetGrid

theWater = theFlowDir.Watershed(theSrcGrid.SnapPourPoint(theAccum,240))

' create a theme

theGTheme = GTheme.Make(theWater)

' check if output is ok

if (theWater.HasError) then

  return NIL

end

' add theme to the view

theView.AddTheme(theGTheme)


Interp MakeIDW Discussion
MakeIDW Discussion

Inverse distance weighted (IDW) interpolation determines cell values using a linearly weighted combination of a set of sample points. The weight is a function of inverse distance. The surface being interpolated should be that of a locationally dependent variable.

IDW allows you to control the significance of known points upon the interpolated values, based upon their distance from the output point. The interpolation can be shifted from local to global by changing the power. A larger power will result in less influence from surrounding points, i.e., nearby data will have the most influence, and the surface will have more detail (be less smooth). The power is a positive, real number. A common value is 2.

The characteristics of the interpolated surface can also be controlled by limiting the input points for calculating each interpolated point. The input can be limited by the number of sample points to be used (specified as a variable Radius object), or by a radius (specified as a fixed Radius object), within which all points are to be used in the calculation of the interpolated locations. The Radius object to be used is identified through the aRadius argument.

The output value from a cell using IDW is limited to the range of values used to interpolate. Because the IDW is a weighted distance average, the average cannot be greater than the highest or less than the lowest input. Therefore, it cannot create ridges or valleys if these extremes have not already been sampled (Watson and Philip, 1985).

The influence of an input point on an interpolated value is isotropic. Since the influence of an input point on an interpolated value is distance related, IDW is not "ridge preserving" (Philip and Watson, 1982).

The best results from IDW are obtained when sampling is sufficiently dense with regard to the local variation you are attempting to simulate. If the sampling of input points is sparse or very uneven, the results may not sufficiently represent the desired surface (Watson and Philip, 1985).

The aBarrierFTab argument is used to specify the location of linear features known to interrupt the surface continuity. These features do not have z values. Cliffs, faults, or embankments are typical examples of barriers. Barriers limit the set of the input sample points used to interpolate output z values to only those samples on the same side of the barrier as the current processing cell. Input sample points that lie exactly on the barrier line are included in the sample set for both sides of the barrier. When barriers are specified, the processing time is significantly extended.

References

Watson, D.F. and Philip, G.M., ‘A Refinement of Inverse Distance Weighted Interpolation.’ Geo-Processing, 2: 315-327, 1985.

Philip, G.M. and Watson, D.F., ‘A precise Method for Determining Contoured Surfaces.’ Australian Petroleum Exploration Association Journal 22: 205-212, 1982.


Interp MakeIDW Example
MakeIDW Example

The following code fragment creates an IDW Interp object that can be passed to the Grid.MakeByInterpolation request to create a surface Grid.

theRadius = Radius.MakeVariable(20, 100)

theSrcName = SrcName.Make("c:\data\barriers.shp")

theBarrierFTab = FTab.Make(theSrcName)

theInterp = Interp.MakeIDW(2,theRadius, theBarrierFTab)


Interp MakeKriging Discussion
MakeKriging / MakeFromVariogram Discussion

Kriging is an advanced interpolation procedure that generates an estimated surface from a scattered set of points with z values. Unlike the other interpolation methods supported by the Spatial Analyst, Kriging involves an interactive investigation of the spatial behavior of the phenomenon represented by the z values before you select the best estimation method for generating the output surface.

The following discussion is merely an introduction to the procedure of using Kriging to produce an estimated surface. Kriging is a complex procedure that requires greater knowledge about spatial statistics than can be conveyed in this reference. Before using the Interp.MakeKriging request, you should have a thorough understanding of the fundamentals of Kriging and have assessed the appropriateness of your data for modeling with this technique. If you do not have a good understanding of this procedure, it is strongly recommended that you review some of the publications listed at the end of this reference.

Kriging is based on the regionalized variable theory that assumes that the spatial variation in the phenomenon represented by the z values is statistically homogeneous throughout the surface; that is, the same pattern of variation can be observed at all locations on the surface. This hypothesis of spatial homogeneity is fundamental to the regionalized variable theory.

Points sets known to have anomalous pits or spikes, or abrupt changes such as those that might be represented by breaklines in a tin, are not appropriate for the Kriging technique. In some cases, the data can be pre-stratified into regions of uniform surface behavior for separate analysis.

The spatial variation is quantified by the semi-variogram. The semi-variogram is estimated by the sample semi-variogram which is computed from the input point data set. The value of the sample semi-variogram for a separation distance of h (referred to as the lag) is the average squared difference in z value between pairs of input sample points separated by h. The sample semi-variogram is calculated from the sample data with the equation:

where n is the number of pairs of sample points separated by distance h.

The semi-variogram is modeled by fitting a theoretical function to the sample semi-variogram. Semi-variograms can be created with the SVGram.Make request.

Here is an example of a typical semi-variogram.

There are several important features worth noting in the sample semi-variogram. At relatively short lag distances of h, the semi-variance is small, but increases with the distance between the pairs of sample points. At a distance referred to as the range, the semi-variance levels off to a relatively constant value referred to as the sill. This implies that beyond this range distance, the variation in z values is no longer spatially correlated. Within the range, the z-value variation is smaller when the pairs of sample points are closer together.

The extent of the x-axis of the semi-variogram is determined by the distance between the most widely separated pair of points in the input sample data. The maximum distance separating the pairs of points used to fit the mathematical function, is determined by the Radus object specified in the aRadius argument.

The aGrid.MakeKriging request offers two types of surface estimators: Ordinary Kriging and Universal. Ordinary Kriging is represented by the SPHERICAL, CIRCULAR, EXPONENTIAL, GAUSSIAN, and LINEAR methods. With these options, available through the aType argument, Kriging uses the mathematical function specified with the method argument to fit a line or curve to the semi-variance data in the semi-variogram. Ordinary Kriging assumes that the variation in z values is free of any structural component (drift). These five models are provided to ensure the necessary conditions of the variogram model are satisfied, which is not always possible with interactive "manual" variogram fitting. These methods and conditions are discussed in McBratney and Webster (1986).

The variance is calculated based upon the average variance of all point pairs within each interval. The semi-variogram is then fit to the variance points using the Levenberg-Marquardt Method (Press et al., 1986) of non-linear least squares approximation. A minimum of three points (a variance value at three distances) are required for the fit. By increasing anInterval when creating the semi-variogram with the SVGram.Make request, you will increase the number of sample points per interval, thereby providing enough data points to estimate the semi-variogram. Once the semi-variogram is estimated, a smaller cell size (used to control the interval) can be used in creating the actual output Grid with the Grid.MakeByInterpolation request by passing it an Interp object that was created with the Interp.MakeFromVariogram with the SVGram object that estimates the semi-variogram.

In some cases, you may suspect that the spatial variation in z values in the data contains local trends. Some researchers have discovered that the presence of locally changing linear drift in the data is indicated when the semi-variogram has a gently parabolic concave upward shape near the origin. Universal Kriging, represented by the UNIVERSAL1 and UNIVERSAL2 methods, assumes that the spatial variation across the surface also has a structural component referred to as drift. Drift is a systematic change in the cell values at a particular scale. This scale is related to the radius of the search area. The goal is to change the search radius to find the scale at which the drift can be detected and the variance is lowest. Therefore, it is not recommended that the a variable Radius object be created for Universal Kriging. UNIVERSAL1 uses a first order polynomial to approximate the drift, and UNIVERSAL2 uses a second order.

Universal Kriging assumes that the spatial variation in cell values is the sum of three components: a structural component (drift), a random but spatially correlated component, and random noise representing the residual error. The structural component represents a constant trend over the surface. The random noise is assumed to be spatially independent and have a normal distribution. Once the structural effect has been accounted for, the remaining variation is spatially homogeneous such that the z-value difference between input sample points is merely a function of the distance between them as with Ordinary Kriging.

The UNIVERSAL1 method uses a linear function to model the drift. The UNIVERSAL2 method uses a quadratic equation to model the drift. Both methods use the LINEAR method to model the remaining semi-variance since most semi-variograms are approximately linear near the origin.

The fixed and variable Radius objects created for the aRadius argument are used to specify the number of samples considered for each output cell. The number of sample points must be large enough to allow the drift to be properly calculated. When using a fixed Radius, you should choose a distance that is within the well-correlated portions of the range. With a variable Radius, current research indicates that you should specify a value of 12 to 15 sample points.

Kriging is very computer-intensive process. The speed of execution is dependent on the number of points in the input data set and the size of the search window.

The aBarrierFTab argument is used to specify the location of linear features known to interrupt the surface continuity. These features do not have z values. Cliffs, faults, or embankments are typical examples of barriers. Barriers limit the set of the input sample points used to interpolate output z values to only those samples on the same side of the barrier as the current processing cell. Input sample points that lie exactly on the barrier line are included in the sample set for both sides of the barrier. When barriers are specified, the processing time is significantly extended.

The following are the general shape and equations of the mathematical models used to describe the semi-variance.

References

Burrough, P.A., (1986). Principles of Geographic Information Systems for Land Assessment. Oxford University Press, New York.

Heine, G.W., (1986). ‘A controlled study of some two-dimensional interpolation method’. COGS Computer Contributions, Vol. 3, No. 2, 60-72.

McBratney, A.B., and Webster, R., (1986). ‘Choosing functions for semi-variograms of soil properties and fitting them to sampling estimates’. Journal of  Soil Science, 37, 617-639.

Oliver, M.A., (1990). ‘Kriging: a method of interpolation for geographical information systems’. International Journal of Geographic Information Systems, Vol. 4, No. 4, 313-332.

Press, W.H. et al. Numerical Recipes in C, The Art of Scientific Computing. New York: Cambridge University Press, 1988.

Royle, A.G., Clausen F.L., and Frederiksen, P. (1981). ‘Practical Universal Kriging and automatic contouring’. Geoprocessing, 1, 377-394.


Interp MakeKriging Example
MakeKriging Example

The following code fragment creates a Kriging Interp object that can be passed to the Grid.MakeByInterpolation request to create a surface Grid.

theRadius = Radius.MakeFixed(250, 7)

theSrcName = SrcName.Make("c:\data\barriers.shp")

theBarrierFTab = FTab.Make(theSrcName)

outVarGridFN = "c:\output\vargrid".AsFileName

theInterp = Interp.MakeKriging(#KRIGING_EXPONENTIAL, theRadius,

                                       theBarrierFTab, outVarGridFN)


Interp MakeSpline Discussion
MakeSpline Discussion

The basic form of the minimum-curvature Spline interpolation imposes the following two conditions on the interpolant:

 The surface must pass exactly through the data points.

 The surface must have minimum curvature-the cumulative sum of the squares of the second derivative terms of the surface, taken over each point on the surface, must be a minimum.

The basic minimum-curvature technique is also referred to as thin plate interpolation. It ensures a smooth (continuous and differentiable) surface together with continuous first-derivative surfaces. Rapid changes in gradient or slope (the first derivative) may occur in the vicinity of the data points; hence this model is not suitable for estimating second derivative (curvature).

The Regularized option identified in the aType argument modifies the minimization criterion so that the third derivative terms are incorporated into the minimization criteria. The aWeight argument specifies the weight attached to the third derivative terms during minimization, referred to as tau in the literature. Higher values of this term lead to smoother surfaces. Values between 0 and 0.5 are suitable. Using the Regularized option ensures a smooth surface together with smooth first-derivative surfaces. This technique is useful if the second derivative of the interpolated surface needs to be computed.

The Tension option identified in the aType argument modifies the minimization criterion so that first-derivative terms are incorporated into the minimization criteria. The aWeight argument specifies the weight attached to the first-derivative terms during minimization, referred to as phi in the literature. A weight of 0 results in the basic thin plate Spline interpolation. Using a larger value of weight reduces the stiffness of the plate, and as j approaches infinity the surface approximates the shape of a membrane or rubber sheets passing through the points. The interpolated surface is smooth. First derivatives are continuous but not smooth.

For computational purposes, the entire space of the output Grid is divided into blocks or regions equal in size. The number of regions in x and in y directions are the same and they are rectangular in shape. The number of regions is determined by dividing the total amount of points in the input point FTab by the value specified for numberPoints. For data less uniformly distributed, the regions may contain a significantly different number of points, with the value of numberPoints being only the rough average. If in any region the number of points is smaller than 8, the region is expanded until it contains a minimum of 8 points.

The Regularized option usually produces more smooth surfaces than those created with the Tension option. For the Regularized option, higher values used for the weight parameter produce smoother surfaces. The values entered for this parameter must be equal to of greater than 0. The typical values that may be used are: 0, 0.001, 0.01, 0.1, and 0.5. However, for the Tension option, higher values entered for the weight parameter results in somewhat coarser surfaces, but surfaces that closely conform the control points. The values entered have to be equal to or greater than 0. The typical values are: 0, 1, 5, and 10.

References

Franke, R., (1982), Smooth Interpolation of Scattered Data by Local Thin Plate Splines. Comp. & Maths. with Applls. Vol. 8. No. 4. pp. 237 - 281. Great Britain.

Mitas, L., and Mitasova, H., (1988), General Variational Approach to the Interpolation Problem. Comput. Math. Applic. Vol 16. No. 12. pp. 983 - 992. Great Britain.


Interp MakeSpline Example
MakeSpline Example

The following code fragment creates a Spline Interp object that can be passed to the Grid.MakeByInterpolation request to create a surface Grid.

theInterp = Interp.MakeSpline(#SPLINE_REGULARIZED, 1, 10)


Interp MakeTrend Discussion
MakeTrend Discussion

The linear trend surface interpolator creates a floating-point Grid. It uses a polynomial regression to fit a least-squares surface to the input points. It allows you to control the order of the polynomial used to fit the surface. Trend interpolation is easy to understand by considering a first-order polynomial. A first-order linear trend surface interpolation simply performs a least-squares fit of a plane to the set of input points.

Trend surface interpolation creates smooth surfaces. The surface generated will seldom pass through the original data points since it performs a best fit for the entire surface. When an order higher than 1 is used, the interpolator may generate a Grid whose minimum and maximum might exceed the minimum and maximum of the input points.

As the order of the polynomial is increased, the surface being fitted becomes progressively more complex. A higher order polynomial will not always generate the most accurate surface, it is dependent upon the data. The lower the RMS error, the more closely the interpolated surface represents the input points. The most common order of polynomials is 1 through 3.

If the useLogistic argument is TRUE, a logistic option for generating a trend surface is used that is appropriate for prediction of presence/absence of certain phenomena (in the form of probability) for a given set of locations (x,y) in space. The z value is a categorized random variable with only two possible outcomes, for instance, the existence of an endangered species or the lack of existence of that species. These two values of z can be coded as 1 and 0, respectively. It creates a continuous probability Grid with cell values between 1 and 0. A maximum likelihood estimation is used to calculate the logistic probability surface model without first converting the model into linear form.


Interp MakeTrend Example
MakeTrend Example

The following code fragment creates a Trend Interp object that can be passed to the Grid.MakeByInterpolation request to create a surface Grid.

theInterp = Interp.MakeTrend(3, FALSE)


MakeByInterpolation Example
Interpolation Example

The following example interpolates a surface GTheme from a point Theme. It uses the InterpolationDialog.Show request to prompt the user with a dialog for parameters to pass to the Grid.MakeByInterpolation request. It assumes that the AnalysisEnvironment extent and cell size for the active View are set to explicit values, and that the explicit value for the cell size is 50. It also assumes that only a point Theme is active.

theView = av.GetActiveDoc

' create surface for active point theme

theTheme = theView.GetActiveThemes.Get(0)

' obtain parameters for the interpolation for a dialog

theCellSize = 50

interpList = InterpolationDialog.Show(theTheme,theCellSize)

' check for Cancel from dialog

if (interpList.Count < 2) then

  return NIL

end

zField = interpList.Get(0)

anInterp = interpList.Get(1)

' perform interpolation

aPrj = theView.GetProjection

theResult =

     Grid.MakeByInterpolation(theTheme.GetFTab,aPrj,zField,anInterp,NIL)

' create a theme

theGTheme = GTheme.Make(theResult)

' check if output is ok

if (theResult.HasError) then

  return NIL

end

' add theme to the view

theView.AddTheme(theGTheme)


MakeFromVariogram Example

The following code fragment creates a Kriging interpolation from a semi-variogram model. A SVGram object is created first and then passed to the Interp.MakeFromVariogram request which creates an Interp object. This Interp object can then be passed to the Grid.MakeByInterpolation request to create a surface Grid.

thePointSrcName = SrcName.Make("c:\data\points.shp")

thePointFTab = FTab.Make(thePointSrcName)

zField = thePointFTab.FindField("Measure")

thePrj = Prj.MakeNull

theSVGram = SVGram.Make(thePointFTab, thePrj, zField, #KRIGING_CIRCULAR, 100)

theRadius = Radius.MakeFixed(250, NIL)

theBarrierSrcName = SrcName.Make("c:\data\barriers.shp")

theBarrierFTab = FTab.Make(theBarrierSrcName)

outVarGridFN = "c:\output\vargrid".AsFileName

theInterp = Interp.MakeFromVariogram(theSVGram, theRadius,

                                       theBarrierFTab, outVarGridFN)


NbrHood MakeIrregular Discussion
MakeIrregular Discussion

The NbrHood.Irregular request allows for specifying an irregularly shaped neighborhood around the processing cell. A List of Lists of Numbers, called a kernel, define the manner in which the cell values of the neighborhood are interpreted. The kernel specifies which cell positions should be included within the neighborhood. The values in the kernel should be either 0 or 1 (any value not equal to 0 is interpreted as 1). A value of 0 for a cell position indicates that the cell is not a member of the neighborhood; a value of 1 for a cell position indicates that its corresponding cell (and value) is a member of the neighborhood. The x,y position for the processing cell within the neighborhood, with respect to the upper-left corner of the neighborhood, is determined by the following equations:

x = (width + 1)/2

y = (height + 1)/2

If the input number of cells is even, the x- and y-coordinates are computed using truncation.

The following kernel would consist of 4 Lists of 5 Numbers each. The 4 Lists are then put into 1 List, with the List for the top line first and the List for the bottom line last. The x,y position for the processing cell is 3, 2. This means that the cell that is 3 from the left side of the neighborhood and 2 from the top of the neighborhood is the processing cell.

1 1 1 0 0

0 0 1 1 1

0 0 1 1 1

1 1 1 0 0


NbrHood MakeIrregular Example
MakeIrregular Example

This example creates an irregular neighborhood and passes it to the aGrid.FocalStats request to create a new GTheme. The neighborhood is the following:

1 0 1 0 1

0 1 0 1 0

1 0 1 0 1

0 1 0 1 0

1 0 1 0 1

Cells with a 1 are included in the neighborhood calculation. The center cell is the processing cell. The new GTheme is added to the active View. It assumes that the active View contains a GTheme, and that it is the only active Theme.

theView = av.GetActiveDoc

' use first active GTheme

theTheme = theView.GetActiveThemes.Get(0)

' obtain grid from theme

theGrid = theTheme.GetGrid

' make the neighborhood

firstLine = {1,0,1,0,1}

secondLine = {0,1,0,1,0}

thirdLine = {1,0,1,0,1}

fourthLine = {0,1,0,1,0}

fifthLine = {1,0,1,0,1}

theKernel = {firstLine,secondLine,thirdLine,fourthLine,fifthLine}

theNbrHood = NbrHood.MakeIrregular(theKernel)

' run operation

theResult = theGrid.FocalStats(#GRID_STATYPE_MEAN,theNbrHood,FALSE)

' create a theme

theGTheme = GTheme.Make(theResult)

' check if output is ok

if (theResult.HasError) then

  return NIL

end

' add theme to the View

theView.AddTheme(theGTheme)


AsGrid (Number)
AsGrid

Makes a Grid of uniform values from aNumb.

This request is only available with the Spatial Analyst.

Syntax

aNumber.AsGrid

Returns

Grid


ReclassEditor Show Example
ReclassEditor.Show Example

This example uses the ReclassEditor.Show request to present the user with a dialog that they can use to define reclassification ranges and outputs to create a new GTheme. The new GTheme is added to the active View. It assumes that the active View contains a GTheme, and that it is the only active Theme.

theView = av.GetActiveDoc

' reclassify first active GTheme

theTheme = theView.GetActiveThemes.Get(0)

' obtain grid from theme

theGrid = theTheme.GetGrid

' obtain reclassification parameters

theParameters = ReclassEditor.Show(theTheme)

' check for Cancel from dialog

if (theParameters = NIL) then

  return NIL

end

fieldName = theParameters.Get(0)

classList = theParameters.Get(1)

' run operation

theResult = theGrid.ReclassByClassList(fieldName, classList, FALSE)

' create a theme

theGTheme = GTheme.Make(theResult)

' check if output is ok

if (theResult.HasError) then

  return NIL

end

' add theme to the view

theView.AddTheme(theGTheme)


Spatial Analyst class hierarchy

Obj

    ExtensionObject

        DocumentExtension

            AnalysisEnvironment

        LegendExtension

            GLegExt

    Grid

    Interp

    ModalDialog

        AnalysisPropertiesDialog

        DensitySurfaceDialog

        FocalStatisticsDialog

        GridLegendWindow

        InterpolationDialog

        ReclassEditor

        TabulateAreaDialog

    NbrHood

    Radius

    SVGram

    Theme

        GTheme


TabulateArea Example

The following example shows the use of the aGrid.TabulateArea request and of the TabulateAreaDialog.Show request for prompting the user for parameters with a dialog to pass to the aGrid.TabulateArea request. It assumes that the active View contains an integer GTheme and a FTheme. It also assumes that the user will pick the integer GTheme as the Column Theme in the dialog, and that the FTheme is chosen for the Row Theme. The Table created will show the area of each attribute of the integer GTheme within zones defined by the FTheme.

theView = av.GetActiveDoc

' obtain projection

aPrj = theView.GetProjection

' obtain parameters for operation

params = TabulateAreaDialog.Show(theView)

' check for Cancel from dialog

if (params = NIL) then

  return NIL

end

colTheme = params.Get(0)

columnGrid = colTheme.GetGrid

colField = params.Get(1)

rowTheme = params.Get(2)

rowObj = rowTheme.GetFTab

rowField = params.Get(3)

' run TabulateArea

areaVTab = columnGrid.TabulateArea(colField,rowObj,aPrj,rowField,FALSE)

' check for errors in operation

if(areaVTab.HasError) then

  return NIL

end

' create table and open

areaTable = Table.Make(areaVTab)

av.GetProject.AddDoc(areaTable)

areaTable.GetWin.Open


Cell Tools Sample Extension (Spatial Analyst extension)
Cell Tools Sample Extension

Description: This extension adds four tool menus to View GUIs. These tools allow you to select each individual grid cell and within each cell display cell value labels, direction arrows, and rectangles. The icons for each tool indicate the tools resulting function.

Notes:

Row and Column tool - Click on any cell and the cell value and the cell row and column position are reported in the message area of the status bar. The selected cell flashes in the Project's selection color.

Cell Draw tool - Click on any cell. The selected cell draws along with the neighboring

eight cells.

Draw Cell Value tool - Draws graphic text containing the selected cell's value.

Direction Arrow tool - Draws direction arrows from 0 to 360 degrees for the selected cell.

Requires: This extension requires the Spatial Analyst Extension. This extension will automatically load the Spatial Analyst if it is not loaded. It also requires a View that contains a tool bar which has one active Grid Theme.

FileName:  celltool.avx


Creates a grid theme by filling all sinks in another grid theme

Source Code

Description: Takes a grid theme and fills all sinks, areas of internal drainage, contained within it. The aGrid.FlowDirection, aGrid.Sink, aGrid.Watershed, aGrid.ZonalFill, and aGrid.Con requests are used to fill the sinks. The process of filling sinks can create sinks, so a looping process is used until all sinks are filled. One cell sinks are not filled. Sinks of any depth are filled.

Name: Spatial.DEMFill

Requires: The Spatial Analyst extension to be loaded. The script also requires an active view with an active grid theme that represents a surface. The grid theme should be the only active theme in the view.

Self:

Returns:

FileName:  demfill.ave


Creates a grid theme by filling all sinks in another grid theme Code

'

' Name: Spatial.DEMFill

'

' Title: Creates a grid theme by filling all sinks in another grid theme.

'

' Topics: Spatial Analyst, Hydrological modeling

'

' Description: Takes a grid theme and fills all sinks, areas of

' internal drainage, contained within it. The aGrid.FlowDirection,

' aGrid.Sink, aGrid.Watershed, aGrid.ZonalFill, and aGrid.Con

' requests are used to fill the sinks. The process of filling

' sinks can create sinks, so a looping process is used until all

' sinks are filled. One cell sinks are not filled. Sinks of

' any depth are filled.

'

' Requires: The Spatial Analyst extension to be loaded. The script

' also requires an active view with an active grid theme that

' represents a surface. The grid theme should be the only active

' theme in the view.

'

' Self:

'

' Returns:

'

theView = av.GetActiveDoc

' fill active GTheme

theTheme = theView.GetActiveThemes.Get(0)

' fill sinks in Grid until they are gone

elevGrid = theTheme.GetGrid

sinkCount = 0

numSinks = 0

while (TRUE)

  flowDirGrid = elevGrid.FlowDirection(FALSE)

  sinkGrid = flowDirGrid.Sink

  if (sinkGrid.GetVTab = NIL) then

    ' check for errors

    if (sinkGrid.HasError) then return NIL end

    sinkGrid.BuildVAT

  end

  ' check for errors

  if (sinkGrid.HasError) then return NIL end

  if (sinkGrid.GetVTab <> NIL) then

    theVTab = sinkGrid.GetVTab

    numClass = theVTab.GetNumRecords

    newSinkCount = theVTab.ReturnValue(theVTab.FindField("Count"),0)

  else

    numClass = 0

    newSinkCount = 0

  end

  if (numClass < 1) then

    break

  elseif ((numSinks = numClass) and (sinkCount = newSinkCount)) then

    break

  end

  waterGrid = flowDirGrid.Watershed(sinkGrid)

  zonalFillGrid = waterGrid.ZonalFill(elevGrid)

  fillGrid = (elevGrid < (zonalFillGrid.IsNull.Con(0.AsGrid,zonalFillGrid))).Con(zonalFillGrid,elevGrid)

  elevGrid = fillGrid

  numSinks = numClass

  sinkCount = newSinkCount

end

' rename data set

aFN = av.GetProject.GetWorkDir.MakeTmp("fill", "")

elevGrid.Rename(aFN)

' create a theme

theGTheme = GTheme.Make(elevGrid)

' set name of theme

theGTheme.SetName("Filled"++theTheme.GetName)

' add theme to the view

theView.AddTheme(theGTheme)


Extract grids by a graphic

Source Code

Description: This script extracts a new grid by clipping from an overlaying graphic.

Name: Spatial.ExtractByGraphic

Requires: The Spatial Analyst Extension.

Self:

Returns:

FileName:  grextrct.ave


Extract grids by a graphic Code

' Name:  Spatial.ExtractByGraphic

'

' Title:  Extract grids by a graphic

'

' Topics:  Spatial

'

' Description: This script extracts a new grid by clipping from an

' overlaying graphic.

'

' Requires:  Spatial Analyst Extension

'

' Self:

'

' Returns:

'

test=Extension.Find("Spatial Analyst")

if (test=NIL) then

 msgbox.error("You must have the spatial analyst extension loaded","ExtractbyShape")

 return(nil)

end

' get the view and the selected graphics

theView = av.GetActiveDoc

theGraphics=theview.getgraphics

theSelg=theGraphics.getselected

if (theSelG.count=0) then

 msgbox.error("No Graphics Selected","ExtractbyShape")

 return(nil)

end

if (theSelG.count>1) then

 msgbox.error("More than one Graphic is Selected, just using one","ExtractbyShape")

end

agraphic=thegraphics.getselected.get(0)

if (agraphic.getshape.is(point)) then

 msgbox.error("Shape must be a line or polygon","ExtractbyShape")

 return(nil)

end

ashp=agraphic.getshape.aspolygon

' set the projection to null since graphics are projected

theprojection=Prj.MakeNull

ashpext=agraphic.getbounds

t = NIL

for each at in theView.GetActiveThemes

  if (at.Is( GTHEME )) then

    t = at

    break

  end

end

if (t = NIL) then

 msgbox.info("A Grid Theme needs to be active in the view", "ExtractbyShape")

 return(NIL)

end

' Set a temporary Analysis Environment

g = t.GetGrid

Grid.SetAnalysisExtent(#GRID_ENVTYPE_VALUE, ashpext)

' Extract the grid cells base on the selected graphic

r = g.ExtractbyPolygon(ashp, theProjection, FALSE)

' rename data set

aFN = av.GetProject.GetWorkDir.MakeTmp("gext", "")

r.Rename(aFN)

' check if output is ok

if (r.HasError) then return NIL end

' create a theme

gthm = GTheme.Make(r)

' set name of theme

gthm.SetName("Extract from " + t.GetName)

' add theme to the specifiedView

theView.AddTheme(gthm)

gthm.invalidate(true)


Hydrologic Modeling Sample Extension (Spatial Analyst extension)
Hydrologic Modeling Sample Extension

Description: Extends the Spatial Analyst user interface for hydrologic modeling. The extension will install a menu and two tools into View GUIs.

Notes: The Hydro menu has choices to set properties, Fill depressions in an elevation grid theme, calculate Flow Direction, calculate Flow Accumulation, calculate Flow Length, and delineate Watershed. Properties sets the flow direction and accumulation grid themes to be used for Watersheds and the two tools. Fill works off an active elevation grid theme.  Flow Direction works off an active elevation grid theme that has been filled. Flow Accumulation works off an active flow direction grid theme. Flow length works off an active flow direction grid theme. Watershed works off an active flow accumulation grid theme and Properties must be set.  Watershed finds all basins in the data set based on a minimum number of cells in each basin.

The two tools added require Properties to be set. The Watershed tool works off an active elevation grid theme that has been filled. It will create a watershed from a point specified on the view. The Raindrop tool works off of an active elevation grid theme that has been filled. It will trace the path of flow from a point specified on the view to an outlet.

Requires: This extension requires the Spatial Analyst Extension. This extension will automatically load the Spatial Analyst if it is not loaded.

FileName:  hydro.avx


Hydrologic Modeling Sample Extension v11 (Spatial Analyst extension)
Hydrologic Modeling Sample Extension v11

Description: This new hydrology extension for the ArcView Spatial Analyst version 1.1 further extends the Spatial Analyst user interface for creating input data for hydrologic models. This extension provides functionality to create watersheds and stream networks from a DEM (a grid data source representing elevation), calculate physical and geometric properties of the watersheds, and aggregate these properties into a single attribute table that can be attached to a grid or shapefile.

Depending upon your needs, the extension has two ways of approaching this functionality. If you simply want to create watersheds, or stream networks, or a particular property of them, work directly with each of these functionality choices under the Hydro pulldown. Otherwise, if you want to create watersheds and calculate many additional attributes for them, use the Hydrologic Modeling choice under the Hydro pulldown.

Hydro pulldown menu:

By placing the mouse pointer over each of the choices under the Hydro pulldown, information about that choice can be seen in the status bar help at the bottom of the ArcView project window. This information includes a short description of that choice and what type of theme should be active in the view to make it useable. Following is a brief description of each choice under the Hydro pulldown.

* Hydrologic Modeling - launches a custom dialog for the creation of watersheds and their characteristics (NOTE: See the “Hydrologic Modeling dialog” section below for more details).

* Flow Direction - computes the direction of flow for each cell in a DEM.

* Identify Sinks - creates a grid showing the location of sinks or areas of internal drainage in a DEM.

* Fill Sinks - fills the sinks in a DEM, creating a new DEM.

* Flow Accumulation - calculates the accumulated flow, or number of up-slope cells, based on a flow direction grid.

* Watershed - creates watersheds based upon a user specified flow accumulation threshold.

* Area - calculates the area of each watershed in a watershed grid.

* Perimeter - calculates the perimeter of each watershed in a watershed grid.

* Length - calculates the straight-line distance from the pour point to the furthest perimeter point for each watershed in a watershed grid.

* Flow Length - calculates the length of flow path for each cell to the pour point for each watershed if you choose Yes, or the length of flow path for each cell to the furthest perimeter point of each watershed if you choose No.

* Flow Length by Watershed - calculates the maximum distance along the flow path within each watershed.

* Shape Factor by Watershed - calculates a shape factor for each watershed. Shape factor is calculated as watershed length squared, divided by watershed area.

* Stream Network As Line Shape - creates a vector stream network from a flow accumulation grid based on a user specified threshold.

* Centroid as Point Shape - creates a point shape file of watershed centroids.

* Pour Points as Point Shape - creates a point shape file of watershed pour points.

* Mean Elevation - calculates the mean elevation within each watershed.

* Mean Slope - calculates the mean slope within each watershed.

* Mean Precipitation - calculates the mean precipitation in each watershed.

* Mean Curve Number - calculates the mean curve number for each watershed.

Hydrologic Modeling dialog:

The Hydrologic Modeling dialog is designed to be a quick one-step method for calculating and then aggregating a set of watershed attributes to a single file. This file can then be used directly in a hydrologic model such as BYU’s WMS, or it can be reformatted for input into HEC’s HMS model, or others.

To use this dialog, you can start with an existing grid of elevation/DEM or a shapefile of watershed boundaries.

To create watersheds from the DEM, choose Delineate from DEM and select an elevation surface. You will be prompted to fill sinks. Though some sinks are valid, most are data errors and should be filled. You will then be prompted to define the minimum number of cells to define a watershed. This will create watersheds based on the number of cells, or up-slope area you have defined as being the smallest watershed you want. After adding the new watersheds as a theme, you will be prompted to use this for further analysis. If you select No, you will be asked to specify a new number of cells for defining basins. If you select Yes and have the ‘Output as shapefile’ option checked on, you will be prompted for an output shapefile name and the attributes you have checked will be calculated.

To use an existing set of watershed boundaries, choose Use Existing Watershed, select a corresponding elevation surface and watershed data source. You will be prompted for a key field for conversion, which will be the common attribute you will want in both data sets (most commonly, the Id field is chosen).

The watershed attributes available in the Hydrologic Modeling dialog are the same as those described above, except for the addition of Stream Flow Length. Stream Flow Length is the longest flow distance on the stream network defined by the flow accumulation threshold used to define the minimum watershed size.

By default, Stream Flow Length, Watershed Length, and Shape Factor are not checked on, because they are slow to calculate, especially for a larger number of basins.

Requires:  This extension requires the Spatial Analyst v1.1 extension and Dialog Designer Extension. This extension will automatically load the Spatial Analyst if it is not already loaded.

FileName:  hydrov11.avx


Shade a DTED in decimal seconds

Source Code

Description: Creates a hillshade grid from a converted DTED source in decimal seconds by calculating an appropriate Zfactor.

Name: Spatial.DTEDShade

Requires: The Spatial Analyst Extension.

Self:

Returns:

FileName:  dtedshad.ave


Shade a DTED in decimal seconds Code

' Description: Creates a hillshade grid from a converted DTED source in decimal seconds by calculating an appropriate Zfactor

'

' Name:  Spatial.DTEDShade

'

' Requires:  Spatial Analyst Extension

'

' Self:

'

' Returns:

'

' FileName:  dtedshad.ave

theView = av.GetActiveDoc

' CREATE HILLSHADE FOR ACTIVE GTHEME

'

t = theView.GetActiveThemes.Get(0)

' OBTAIN PARAMETERS FOR HILLSHADE

'

status = TRUE

while (status)

  paramList = MsgBox.MultiInput("Input parameters for hillshade:","Compute Hillshade",{"Azimuth (0 - 360):","Altitude (0 - 90):"},{"315","45"})

  if (paramList.Count <2)

  then

   return NIL

  end

  theAzimuth = paramList.Get(0)

  theAltitude = paramList.Get(1)

  if (theAzimuth.IsNumber and ((theAzimuth.AsNumber >= 0) and (theAzimuth.AsNumber <= 360)))

  then

    azOK = TRUE

  else

    azOK = FALSE

    MsgBox.Info("Azimuth must be a number from 0 to 360","Compute Hillshade")

  end

  if (theAltitude.IsNumber and ((theAltitude.AsNumber >= 0) and (theAltitude.AsNumber <=

  90))) then

    alOK = TRUE

  else

    alOK = FALSE

    MsgBox.Info("Altitude must be a number from 0 to 90","Compute Hillshade")

  end

  if (azOK and alOK) then

    status = FALSE

  else

    status = TRUE

  end

end

' OBTAIN GRID FROM THEME AND CREATE HILLSHADE

'

g = t.GetGrid

'r = g.HillShade(theAzimuth.AsNumber,theAltitude.AsNumber,NIL)

'zFactor = ( 1 / length of degree of long ) * 3600

theRec  = t.ReturnExtent

theLatitudeBottom  = theRec.GetBottom.Abs

theLatitudeTop = theRec.GetTop.Abs

if (theLatitudeTop > theLatitudeBottom) then

  theDiff = theLatitudeTop - theLatitudeBottom

  theHalfDiff = theDiff / 2

  theLatitude = theLatitudeTop - theHalfDiff

else

  theDiff = theLatitudeBottom - theLatitudeTop

  theHalfDiff = theDiff / 2

  theLatitude = theLatitudeTop + theHalfDiff

end

zFactor = ( 1 / (6370997*(theLatitude.Cos)*(Number.GetPi/180))) * 3600

msgbox.info(zfactor.AsString,"Z factor")

r = g.HillShade(theAzimuth.AsNumber,theAltitude.AsNumber,zFactor)

' RENAME DATA SET

'

aFN = av.GetProject.GetWorkDir.MakeTmp("hlshd", "")

r.Rename(aFN)

' ERROR CHECK

'

if (r.HasError) then return NIL end

' CREATE A THEME

'

gthm = GTheme.Make(r)

' CREATE APPROPRIATE LEGEND FOR THEME

'

theLegend = gthm.GetLegend

theLegend.Area(gthm,"Value",9)

theSymbolList = theLegend.GetSymbols

theNullSymbol = theSymbolList.Get(theSymbolList.Count - 1)

theSymbolList.Remove(theSymbolList.Count - 1)

theSymbolList.RampColors(Color.GetBlack,Color.GetWhite)

theSymbolList.Add(theNullSymbol)

gthm.UpdateLegend

' SET NAME OF THEME

'

gthm.SetName("Hillshade of " + t.GetName)

' ADD THEME TO THE SPECIFIED VIEW

'

theView.AddTheme(gthm)


Shift a DTED from decimal seconds to decimal degrees

Source Code

Description: Imports a DTED file and automatically creates a grid theme in a decimal degree coordinate system rather than decimal seconds (default).

Name: Spatial.DTEDShift

Requires: The Spatial Analyst Extension.

Self:

Returns:

FileName:  dtedshft.ave


Shift a DTED from decimal seconds to decimal degrees Code

' Description:  Imports a DTED file and automatically creates

' a grid theme in a decimal degree coordinate system rather than

' decimal seconds (default).

'

' Name:  Spatial.DTEDShift

'

' Requires:  Spatial Analyst Extension

'

' Self:

'

' Returns:

'

' FileName:  dtedshft.ave

theView = av.GetActiveDoc

' SET PATTERNS AND TITLE

'

  theTitle = "Import" ++ "DTED" ++ "Files"

  thePatterns = {"*.dt1","*.*"}

  theLabels = {"DTED Files (*.dt1)", "All Files (*.*)"}

' FIND THE FILE

'

inFNList = FileDialog.ReturnFiles(thePatterns,theLabels,theTitle,0)

if (inFNList = NIL) then return NIL end

if (inFNList.Count < 1) then return NIL end

firstTime = TRUE

for each inFN in inFNList

  if (firstTime) then

    def = av.GetProject.MakeFileName("imgrd", "")

  else

    def = FileName.GetCWD.MakeTmp("imgrd","")

  end

'  theTmp = FileName.GetCWD.MakeTmp("tmp","")

'  def    = av.GetProject.MakeFileName("imgrd", "")

  ' FIND THE OUTPUT NAME FOR GRID

  '

  gridFN = SourceManager.PutDataSet(GRID,"Output Grid :" ++ inFN.GetBaseName,def,TRUE)

  if (gridFN = NIL) then continue end

  ' PERFORM CONVERSION

  '

    r = Grid.MakeFromDTED(inFN)

  'GRID SHIFT SECTION

  '

    theRec  = r.GetExtent

    theBot  = theRec.GetBottom

    theLeft = theRec.GetLeft

    theSize = r.GetCellSize

    theNewGrid = r.Shift(((theLeft/3600)@(theBot/3600)),(theSize/3600))

    theNewGrid.SaveDataSet(gridFn)

    theNewGtheme = GTheme.Make(theNewGrid)

    theView.AddTheme(theNewGtheme)

  ' SAVE DATA SET WITH NAME GIVEN BY USER

  status = Grid.GetVerify

  Grid.SetVerify(#GRID_VERIFY_OFF)

  if (r.SaveDataSet(gridFN).Not) then

    Grid.SetVerify(status)

    continue

  end

  Grid.SetVerify(status)

  ' ERROR CHECKING

  '

    if (r.HasError) then

    MsgBox.Error("File" ++ inFN.GetBaseName ++ "can not be imported as a Grid", "Import Error") continue

  end

  firstTime = FALSE

end


Visibility Tools Sample Extension (Spatial Analyst extension)
Visibility Tools Sample Extension

Description: This extension adds two tools to View GUIs.  This extension requires the Spatial Analyst be loaded. These tools allow you to generate a profile / line-of-sight diagram and a visibility surface. The profile tool allows you to enter a 2 point line, once you've entered the line the tool calculates the profile of your grid along that line and generates a chart of the profiles, in addition the chart displays red or green sections indicating if the section is in your line of sight. The visibility tool allows you to drag a line indicating where the observer is standing and where they are looking towards.  The script then writes out the angle of view and generates a visibility grid.

Requires: This extension requires the Spatial Analyst Extension. This extension will automatically load the Spatial Analyst if it is not loaded.

FileName:  vistools.avx


Warp Environment Sample Extension (Spatial Analyst extension)
Warp Environment Sample Extension

Description: Extends the Spatial Analyst user interface for georeferencing/warping grid data sets. The extension will install a menu, a button, and two tools into view GUI's. The Warp menu has choices of Set From View, Set To View, Set Link Table, Create Link Table, Type-in From Link, Type-in To Link, Calculate Fit, and Warp.

Notes:

Warp menu:

- Set From View sets a view document where the ungeoreferenced grid data set is displayed. This menu choice is enabled when a view document is available to be specified as the From View.

- Set To View sets a view document where the georeferenced data is displayed. This menu choice is enabled when a view document is available to be specified as the To View.

- Set Link Table sets a Link Table (a table containing coordinates of "from" links and "to" links) to be used in the warp calculation. This menu choice is enabled when a valid Link Table exists within the current project, which meets certain specifications (it must have the following 5 numeric fields present: Link, From_X, From_Y, To_X, and To_Y).

- Create Link Table creates (and sets) an empty Link Table to be used in the warp calculation. The links are then created and logged into this table.

- Type-in From Link allows the "from" link coordinates to be manually typed into the Link Table. This menu choice is enabled when the From View is active, a Link Table is set, and all links (if any) have both "from" link and "to" link coordinates.

- Type-in To Link allows the "to" link coordinates to be manually typed into the Link Table. This menu choice is enabled when the To View is active, a Link Table is set, and a link in the Link Table is incomplete.

- Calculate Fit allows the user to attain polynomial fit statistics on the active grid theme with the links found in the current link table without actually performing the warp of the grid. This is used to test the goodness of fit for a polynomial transformation based on the current links. The result is a message box with total RMS error values and Chi-Square values for both the X and Y directions. Also, two tables are produced: the Coefficients Table and the Errors Table. The Coefficients Table has the following Fields: Coef #, X Coef, and Y Coef. There will be a record for each coefficient in the transformation. The Errors Table has the following Fields: Link-id, Input X, Input Y, Output X, Output Y, X Error, and Y Error. There will be a record for each link. This menu choice is enabled when the From View is active, a grid theme is the active theme, a Link Table is set, and all links have both "from" link and "to" link coordinates.

- Warp starts the warp calculation. Once started, the next dialog asks for the polynomial number to be used (i.e. 1 - 12), and then the next dialog asks for the type of resampling method (i.e. Nearest Neighbor, Bilinear, or Cubic Convolution). The resultant warped grid data set is then added to the To View. This menu choice is enabled when the From View is active, a grid theme is the active theme, a Link Table is set, and all links have both "from" link and "to" link coordinates.

Delete Links button:

The Delete Links button deletes existing links by link number. This button is enabled when the Link Table is set, has one or more links, and all links have both "from" link and "to" link coordinates.

From Link tool:

Adds a "from" link (graphically) to the From View (ungeoreferenced data location). This tool is enabled when the From View is active, the Link Table is set, and all links (if any) have both "from" link and "to" link coordinates.

To Link tool:

Adds a "to" link (graphically) to the To View (georeferenced data location). This tool is enabled when the To View is active, the Link Table is set, and a link is incomplete.

Usage:

A typical session using the Warp Environment sample extension would include the following procedures.

1. Follow directions in ArcView's on-line help system for instructions on how to use environment variables to teach ArcView where the Warp Environment extension (warp.avx) file is located.  Search in the on-line help's Index on "AVEXT or "USEREXT".

2. Start ArcView and load the Warp Environment extension.

3. Open a new view and designate it as the From View using the Set From View choice on the Warp menu. Add the ungeoreferenced grid data set to this view and draw it.

4. Open another new view and designate it as the To View using the Set To View choice on the Warp menu. Add the georeferenced data set(s) to this view and draw them. (Simply just designate the To View and do not add data to it if georeferenced data is not available.)

5. Choose the Create Link Table option on the Warp menu and then name the Link Table file on disk. If you have already created a link table from a previous session, you can add that table to the project and then use the Set Link Table option to designate it as the table containing the links.

6. Arrange the From View and the To View so that you can see them both in full. Examine the data in each for notably matchable locations that usually do not change with time (i.e. road intersections and buildings are good matchable locations but lake boundaries tend not to be).

7. Make the From View active and click on the From Link tool. Click on one of the locations noted in Step 6. This adds a "from" link into the Link Table. ("From" link coordinates can also be entered manually with the Type-in From Link menu choice on the Warp menu.)

8. Automatically, the To View and the To Link tool becomes active so click the matching location chosen in Step 7. This adds a "to" link into the Link Table. ("To" link coordinates can also be entered manually with the Type-in From Link menu choice on the Warp menu, for situations where georeferenced data is not available and coordinates can be accessed via other means (existing hard-copy maps, ground truthing with GPS, etc).)

9. Repeat Steps 7 and 8 several times (at least three links are required but more links will create a more accurate result) making "from" and "to" links in all areas of the ungeoreferenced grid. This will ensure that all areas of the grid data set are warped properly. Use the Delete Links button at any time to delete the links that are not placed properly.

10. When all links are in place, make sure the From View is active and choose Calculate Fit (this menu choice allows you to test the goodness of fit for a polynomial transformation when you warp the grid). Choose a polynomial order and click OK. Examine the Total RMS error and Chi-Square values in the Fit Statistics message box and then click OK. Now, examine the output Coefficients Table and Errors Table. Please refer to the on-line help for the request CalcPolynomialFit for details concerning these statistics and values. Make changes by adding, deleting links where necessary in the Link Table and calculate the fit again. If you are unsure about deleting a link that you consider correct but is showing large RMS error values, simply select all the links to be considered and re-calculate the fit.

11. Again, make sure the From View is active and choose the Warp option at the bottom of the Warp menu (make a selection on the Link Table to consider a set of links if deemed useful). Choose a polynomial order and then choose a resampling technique.

12. Draw the newly warped grid data set, which is named "Warp of (original grid theme)" and added to the To View.

13. Examine the new grid in the To View to see if the warp was successful for your needs.

14. Make selections, add, or delete links on the Link Table and run the warp calculation again if deemed necessary.

Requires: This extension requires the Spatial Analyst Extension version 1.1. This extension will automatically load the Spatial Analyst if it is not loaded.

FileName:  warp.avx