GeoAnalyst


Supported with:
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 Analyst extension license. The library provides an easy to customize environment and includes tools for application development. As a shared library, it builds on 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 complement the SpatialAnalyst library, such as the 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, such as 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:
  1. Obtain a Spatial Analyst or 3D Analyst extension license.
  2. Set the analysis environment.
  3. Access the input data.
  4. Perform an operation.
  5. Use 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 Analyst extension license. As previously stated, objects in the GeoAnalyst library can utilize an ArcGIS 3D or Spatial Analyst 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 GeoAnalyst objects are detailed in the following diagram:

RasterAnalysis

The analysis environment (through the RasterAnalysis object) controls a number of primary properties, such as cell size, extent, mask, spatial reference, and workspace, when performing analysis. These settings have no affect on the original data; however, the extent and mask do affect the locations where the operation occurs. The extent defines the area on which the operation is performed. The mask defines the cell locations within the extent on which to perform the operation. 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

The RasterDescriptor object provides access to members that control the raster descriptor. It provides a way of using a field (other than the value field) in the raster table to perform queries. It also allows you to perform a query, using a where clause, then to use 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

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

RasterConversionOp

The RasterConversionOp object provides a means to convert 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), and you can specify 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 or binary floating-point files, respectively. 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. The same method in the IRasterImportOp2 interface has an additional parameter that specifies 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

The RasterTransformationOp object provides a mechanism to transform raster data. The ITransformationOp interface provides access to the following methods to transform the dataset:
See the following code example:
[Java]
Interfaces: ITransformationOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment,
    ISupportErrorInfo Methods: Clip, Flip, Mirror, Mosaic, ProjectFast, Resample,
    Rescale, Rotate, Shift, Warp

RasterMakerOp

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:

RasterMathSupportOp

The RasterMathSupportOp object provides a few basic operations and is shared by the ArcGIS Spatial Analyst and 3D Analyst extensions. For example, RasterMathSupportOp can be used to change z units of an elevation raster in the 3D Analyst environment. The RasterMathOps class, however, 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

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. A range can 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. For example, the IRemap interface allows 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 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

The RasterReclassOp object is used to perform the reclass operation. RasterReclassOp can also be used for classification, which can then lead to vectorization and subsequent vector-based overlay analysis. 
The IReclassOp interface supports the following methods:

RasterRadius

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 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

Focal functions compute an output raster where the output value at each location is a function of the input cells in a specified neighborhood of the location. The IRasterNeighborhood interface contains the following methods that provide the different neighborhood options:
See the following code example:
[Java]
Interface: IRasterNeighborhood Methods: SetAnnulus, SetCircle, SetDefault,
    SetIrregular, SetRectangle, SetWedge, SetWeight

RasterInterpolationOp

The IInterpolationOp interface gives you access to the following methods:
The IInterpolationOp2 interface gives you access to the following additional methods:
 
The IRasterRadius interface on the RasterRadius object defines how the points used in the interpolation method are selected.
The IInterpolationOp3 interface contains the TrendWithRms method that outputs 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

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

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

RasterSurfaceOp

The RasterSurfaceOp object contains the following methods that control the generation of a raster surface:
See the following code example:
[Java]
Interfaces: ISurfaceOp, IGeoAnalysisEnvironment, IRasterAnalysisEnvironment,
    ISurfaceOp2 Methods: Aspect, Contour, ContourAsPolyline, ContourList,
    ContoursAsPolylines, Curvature, CutFill, HillShade, Slope, Visibility

RasterModel

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

GridTableOp

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 in the following ways: 
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;
}