GeoAnalyst


Supported with:
  • Engine with 3D
  • Engine with Spatial
  • ArcView with 3D Analyst
  • ArcView with Spatial Analyst
  • ArcEditor with 3D Analyst
  • ArcEditor with Spatial Analyst
  • ArcInfo with 3D Analyst
  • ArcInfo with Spatial Analyst
  • Server with 3D
  • Server with Spatial
Library dependencies: System, SystemUI, Geometry, Display, Server, Output, Geodatabase, GISClient, DataSourcesFile, DataSourcesGDB, DataSourcesOleDB, DataSourcesRaster, DataSourcesNetCDF, GeoDatabaseDistributed, GeoDatabaseExtensions, Carto, NetworkAnalysis, Location

Additional library information: Contents, Object Model Diagram

The GeoAnalyst library is a shared object library available to users who have an ArcGIS 3D or Spatial extension license. Its environment is customizable and includes tools for application development. As a shared library, it builds upon the raster related objects of the DataSourcesRaster library by providing objects that are used to access, analyze, manage, convert, and visualize raster data.

See the following sections for more information about this namespace:

Features of the GeoAnalyst library

As a shared library, GeoAnalyst includes features that compliment the SpatialAnalyst library, such as unified data access and interaction independent format, a high-level nonproprietary language.
To increase system performance, raster outputs from some methods, such as Slope, are not computed until they are used. This deferred evaluation of output datasets can result in outputs never being calculated if they are never used. Any use of the output, including creating a layer, examining the height and width of the output, or making the dataset permanent, triggers evaluation of the expression to create the dataset.
There are many objects in the GeoAnalyst object model and hundreds of methods to perform spatial modeling. Even though there are many objects and methods, the following are the five main steps when implementing any GeoAnalyst operation:
  • Obtaining a Spatial Analyst or a 3D Analyst license
  • Setting the analysis environment
  • Accessing the input data
  • Performing an operation
  • Using the output
For more information, see Working with Spatial Analyst.
The SpatialAnalyst library also includes objects used to process raster datasets; however, these are available only to users who have an ArcGIS Spatial extension license. As previously stated, objects in the GeoAnalyst library can utilize an ArcGIS 3D or Spatial extension license.

Running concurrent spatial operations

SpatialAnalyst and GeoAnalyst objects are not threadsafe at ArcGIS 9.0. Running concurrent spatial operations using the same workspace may crash the application. The workaround is to use separate output workspaces for each process or application. However, the SpatialAnalyst and GeoAnalyst objects are threadsafe at ArcGIS 9.2

GeoAnalyst objects

The following illustration shows the GeoAnalyst objects:

RasterAnalysis class

The analysis environment (through the RasterAnalysis object) controls a number of primary properties when performing analysis, cell size, extent, mask, spatial reference, and workspace. Even though these settings do nothing to the original data, the extent and mask affect the locations where the operation occurs. The extent defines the area on which the operation is performed. The mask defines the cell locations in the extent on which to perform the operation, and the specified cell size controls the resolution of the output.
When created, the new operator object obtains its parameters from the settings in the RasterAnalysis object. Each operator object can have its own analysis environment settings. You can set the environment parameters individually for each operator object.
The following code example shows how to change the default analysis environment settings that new operator objects will inherit:
[Java]
/**
 * Create a RasterAnalysis object and set it as default.
 */
IRasterAnalysisEnvironment setNewDefaultEnvironment(IEnvelope extent, double
    cellSize, IGeoDataset mask, IWorkspace workspace, ISpatialReference projection){
    try{
        // Create a RasterAnalysis object.
        RasterAnalysis rasterAnalysis = new RasterAnalysis();

        //Set the new default extent.
        rasterAnalysis.setExtent(esriRasterEnvSettingEnum.esriRasterEnvValue, extent,
            null);

        //Set the new default cell size.
        if (cellSize > 0){
            rasterAnalysis.setCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue,
                cellSize);
        }

        //Set the new default mask for analysis.
        if (mask != null){
            rasterAnalysis.setMaskByRef(mask);
        }

        //Set the new default output workspace.
        if (workspace != null){
            rasterAnalysis.setOutWorkspaceByRef(workspace);
        }

        //Set the new default output spatial reference.
        if (projection != null){
            rasterAnalysis.setOutSpatialReferenceByRef(projection);
        }

        //Set it as the default settings.
        rasterAnalysis.setAsNewDefaultEnvironment();

        //Return reference to the default environment setting.
        return rasterAnalysis;
    }
    catch (Exception e){
        System.out.println("Could not set new default environment: " + e.getMessage()
            );
        return null;
    }
}

RasterDescriptor class

The RasterDescriptor object provides access to members that control the raster descriptor. It provides a way of using a field (other than value) in the raster table to perform queries. It also performs a query, using a where clause, and uses this subset to perform the analysis. A selection set can also be created for use in further analysis, for example, RasterDescriptor can be used in RasterReclassOp.

FeatureClassDescriptor class

The FeatureClassDescriptor object provides access to members that control the FeatureClass descriptor and provides a way of using values of a specified field or fields, for example, it can be used with the members of IInterpolationOp and IDistanceOp.

RasterConversionOp class

The RasterConversionOp object converts between raster and feature data. The different interfaces have the conversion operations grouped according to similar processes. The RasterDataToLineFeatureData, RasterDataToPointFeatureData, and RasterDataToPolygonFeatureData methods convert raster data to line, point, and polygon feature data respectively.
The ToFeatureData method converts raster data to feature data (FeatureClass or FeatureDataset) where the user specifies the geometry. The ToRasterDataset method converts feature data to a raster format.
The ExportToASCII and ExportToFloat methods convert raster datasets to a flat file of ASCII and binary floating point files. The ImportFromASCII and ImportFromFloat methods import data from these flat files and creates rasters.
The ImportFromUSGSDEM method in the IRasterImportOp interface converts a digital elevation model (DEM) in United States Geological Survey (USGS) format to a raster and the method in the IRasterImportOp2 interface has an additional parameter to specify the number of ground x,y units in one surface z unit.
See the following code example:
[Java]
Interfaces: IConversionOp, IRasterAnalysisEnvironment, IRasterExportOp,
    IRasterImportOp, IRasterImportOp2 Methods: RasterDataToLineFeatureData,
    RasterDataToPointFeatureData, RasterDataToPolygonFeatureData, ToFeatureData,
    ToRasterDataset, ExportToASCII, ExportToFloat, ImportFromASCII, ImportFromFloat,
    ImportFromUSGSDEM, ImportFromUSGSDEM(in IRasteImportOp2 interface)

RasterTransformationOp class

The RasterTransformationOp object provides a mechanism to transform raster data. The ITransformationOp interface provides access to the following methods to transform the dataset:
  • Clip method—Cuts out a rectangular portion of a raster.
  • Flip method—Flips the raster along the horizontal axis.
  • Mirror method—Mirrors the raster along the vertical axis.
  • Rotate method—Rotates a raster around the specified pivot point by an angle specified in degrees.
  • Mosaic method—Creates one raster from multiple input rasters using a user selectable method to deal with overlapping areas of the neighboring rasters.
  • ProjectFast method—Projects a raster to a new spatial reference using the esriGeoAnalysisResampleEnum enumerator, which allows you to pick a nearest, bilinear, or cubic resampling technique.
  • Warp method—Transforms or rubber sheets a raster along a set of links using a polynomial transformation.
  • Resample method—Resamples a raster to a new cell size.
  • Rescale method—Scales a raster by the specified x,y scale factors.
  • Shift method—Shifts a raster in the x,y direction by specifying the respective distances.
See the following code example:
[Java]
Interfaces: ITransformationOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment,
    ISupportErrorInfo Methods: Clip, Flip, Mirror, Mosaic, ProjectFast, Resample,
    Rescale, Rotate, Shift, Warp

RasterMakerOp class

The RasterMakerOp objects can be used to create new raster datasets. The IRasterMakerOp interface supports the following methods for creating new datasets that are available on the IRasterMakerOp interface:
  • MakeConstant method—Creates a dataset that consists of a single integer or floating point value.
  • MakeNormal method—Creates a raster of random values from a normal distribution with a mean of 0 and a standard deviation of 1.
  • MakeRandom method—Creates a raster that consists of random numbers between 0 and 1 with the choice of specifying an optional seed value.

RasterMathSupportOp class

The RasterMathSupportOp object provides a few basic operations and is shared between ArcGIS Spatial Analyst and 3D Analyst. For example, RasterMathSupportOp can be used for changing z units of an elevation raster in the 3D Analyst environment; however, the RasterMathOps class has the complete list of methods available to users of ArcGIS Spatial Analyst. See the following code example:
[Java]
Interfaces: IMathSupportOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment
    Methods: Divide, esri_float, esri_int, Minus, Plus, Times

NumberRemap class

The NumberRemap object can assist in operations involving the reclassification of numerical data. A single value can be mapped onto a range and visa versa and a range can also be remapped onto another range by using the methods on the INumberRemap interface. The NumberRemap object can be useful for classifications, which can then lead to vectorization and subsequent vector based, overlay analysis. The IRemap interface allows one access to the method on the RasterReclassOp object. See the following code example:
[Java]
Interfaces: INumberRemap, IRemap Methods: LoadNumbersFromASCIIFile,
    LoadNumbersFromTable, MapRange, MapRangeToNoData, MapValue, QueryNumberRecord,
    QueryNumberValue

StringRemap class

The StringRemap object allows you to perform operations that control the reclassification of string data. The StringRemap object can be used, for example, in a suitability study to assign weights to a raster. The IRemap interface allows one access to the ReclassByRemap method on the RasterReclassOp object. See the following code example:
[Java]
Interfaces: IStringRemap, IRemap Methods: LoadStringFromTable, MapString,
    MapStringToNoData, QueryStringRecord, QueryStringValue, Clear, DeleteRecord,
    HasValueToNoData, QueryNoData, QueryRecord, RepresentAsTable, SaveAsTable

RasterReclassOp class

The RasterReclassOp object is used to perform the reclass operation. RasterReclassOp can also be useful for classification, which can lead to vectorization and subsequent vector based, overlay analysis. See the following supported methods:
  • Lookup method—Creates a new raster by looking up values found in another field in the table of the input raster.
  • Reclass method—Reclassifies (or changes) the values in a raster.
  • ReclassByASCIIFile method—Reclassifies (or changes) the value of the input cells of a raster by using an ASCII remap file.
  • ReclassByRemap method—Reclassifies (or changes) the values of the input cells of a raster by using a remap that is built programmatically in the IRemap interface on the NumberRemap or StringRemap objects.
  • Slice method—Slices (or changes) a range of values of the input cells by using the enumerators listed in esriGeoAnalysisSliceEnum, which allow you to choose between an equal area or an equal interval method.

RasterRadius class

The RasterRadius object defines a mechanism to control the radius used to determine a surface, for example, through interpolation. It is used to define the number of points via a fixed or variable radius. For example, it can be used in the IDW method on the RasterInterpolationOp to specify a fixed or variable number of points to consider when estimating a value at a location. See the following code example:
[Java]
Interface: IRasterRadius Methods: SetFixed, SetVariable

RasterNeighborhood class

Focal functions compute an output raster where the output value at each location is a function of the input cells in some specified neighborhood of the location. The IRasterNeighborhood interface contains the following methods that provide the different neighborhood options:
  • SetAnnulus method—Defines the region lying between two concentric circles to be used as a neighborhood.
  • SetDefault method—Creates a 3 by 3 neighborhood.
  • SetIrregular method—Sets a neighborhood object whose entries can be turned on or off.
  • SetWeight method—Sets a neighborhood object whose entries can be assigned a weight and can be used in the PointDensity method associated with the RasterNeighborhood object.
See the following code example:
[Java]
Interface: IRasterNeighborhood Methods: SetAnnulus, SetCircle, SetDefault,
    SetIrregular, SetRectangle, SetWedge, SetWeight

RasterInterpolationOp class

The IInterpolationOp interface allows one to access the following methods:
  • IDW method—Inverses distance weighted interpolation on a point feature dataset.
  • Krige method—Interpolates a surface from a set of points using kriging.
  • Spline method—Interpolates a surface from a set of points using a minimum curvature spline technique.
  • Trend method—Performs a trend interpolation on a point data set.
  • Variogram method—Similar to the krige method; except it allows you to specify additional kriging parameters pertaining to the semivariogram. This is done through the GeoAnalysisSemiVariogram class.
The IInterpolationOp2 interface allows access to the following:
  • NaturalNeighbor method—Creates a surface from points using a natural neighbor interpolation technique.
  • TopoToRasterByFile class—Generates a hydrologically correct raster of elevation values from point, line, and polygon datasets.
  • IRasterRadius on the RasterRadius object—Defines how the points used in the interpolation method are selected.
The IInterpolationOp3 interface introduces TrendWithRms to output the goodness of fit statistics of the Trend surface to a text file. See the following code example:
[Java]
Interfaces: IInterpolationOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment,
    IInterpolationOp2 Methods: IDW, Krige, Spline, Trend, Variogram, NaturalNeighbor,
    TopoToRasterByFile

GeoAnalysisSemiVariogram class

The GeoAnalysisSemiVariogram object creates a Semivariogram object that can be used in the Variogram method that is contained in the IInterpolationOp interface. The DefineVariogram method is used to initialize the semivariogram parameters. See the following code example:
[Java]
Interface: IGeoAnalysisSemiVariogram Method: DefineVariogram

RasterConvertHelper class

The RasterConvertHelper objects are included to assist when converting geodatasets to rasters or feature classes. These methods do not require you to specify the workspace or the name and is useful for operations where temporary output is required. See the following code example:
[Java]
Interface: IRasterConvertHelper Methods: ToRaster1, ToRaster2, ToRaster3,
    ToShapefile

RasterSurfaceOp class

The RasterSurfaceOp object contains the following methods that control the generation of a raster surface:
  • Aspect method—Identifies the direction of maximum rate of change in z values from each cell.
  • Contour method—Creates contours or isolines from a raster surface.
  • ContourAsPolyline method—Creates contours or isolines that pass through a specified point on a surface.
  • ContourList method—Creates contours or isolines based on a list of contour values.
  • Slope method—Identifies the rate of maximum change in z values from each cell.
  • Curvature method—Calculates the curvature of a surface at each cell center. From an applied viewpoint, output of the curvature method can be used to describe the physical characteristics of a drainage basin in an effort to understand erosion and runoff processes. The slope affects the overall rate of movement downslope and the Aspect method defines the direction of flow. The profile curvature affects the acceleration and deceleration of flow; therefore, influences erosion and deposition. The planform curvature influences convergence and divergence of flow.
  • CutFill method—Creates output with volume information describing surface changes after a cut-and-fill operation.
  • HillShade method—Creates a shaded relief raster from a raster by considering the illumination angle and shadows.
  • Visibility method—Performs visibility analysis on a raster by determining how many observation points can be seen from each cell location of the input raster, or which cell locations can be seen by each observation point. The Visibility method on the ISurfaceOp2 interface has two additional parameters; the number of ground x,y units in one surface z unit and a coefficient of the refraction of visible light in air.
See the following code example:
[Java]
Interfaces: ISurfaceOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment,
    ISurfaceOp2 Methods: Aspect, Contour, ContourAsPolyline, ContourList,
    ContoursAsPolylines, Curvature, CutFill, HillShade, Slope, Visibility

RasterModel class

The RasterModel object is used to perform raster analysis using map algebra expressions and can include nonraster input and output formats (feature data, tables, and so on). It also allows the usage of multiple lines of GRID syntax. See the following code example:
[Java]
Interfaces: IRasterModel, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment
    Methods: BindFeatureClass, BindRaster, BindString, BindTable, Execute,
    UnbindSymbol

GridTableOp class

The GridTableOp object is used to perform operations on the Table object associated with a GRID dataset. The IGridTableOp interface offers a way to add a field to the dataset or to delete a field from the dataset. A field can also be updated based on query filter. The AddField method is used to add a Field object to the dataset and the DeleteField method is used to delete a field object from the dataset. See the following code example:
[Java]
Interfaces: IGridTableOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment
    Methods: AddField, DeleteField, Update

Enabling the Spatial Analyst license

To access the ArcGIS GeoAnalyst objects, obtain a Spatial Analyst license or a 3D Analyst license. You can call for a license prior to accessing each GeoAnalyst object, call it once in a single method, or call once globally in the main routine of a program. Since you only need to call the single method once—the license is automatically enabled if you call it globally—either approach is the preferred method for obtaining a license. See the following code example:
[Java]
boolean canCheckOutSpatialAnalystLicense(AoInitialize aoInitializer){
    try{
        aoInitializer.checkOutExtension
            (esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst);
    }
    catch (Exception e){
        System.out.println("Couldn't checkout spatial analyst extension");
        System.out.println(e.getMessage());
        return false;
    }
    return true;
}