- Engine with 3D Analyst
- Engine with Spatial Analyst
- ArcGIS for Desktop Basic with 3D Analyst
- ArcGIS for Desktop Basic with Spatial Analyst
- ArcGIS for Desktop Standard with 3D Analyst
- ArcGIS for Desktop Standard with Spatial Analyst
- ArcGIS for Desktop Advanced with 3D Analyst
- ArcGIS for Desktop Advanced with Spatial Analyst
- Server with 3D Analyst
- Server with Spatial Analyst
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
- Running concurrent spatial operations
- GeoAnalyst objects
- RasterAnalysis
- RasterDescriptor
- FeatureClassDescriptor
- RasterConversionOp
- RasterTransformationOp
- RasterMakerOp
- RasterMathSupportOp
- NumberRemap
- StringRemap class
- RasterReclassOp
- RasterRadius
- RasterNeighborhood
- RasterInterpolationOp
- GeoAnalysisSemiVariogram
- RasterConvertHelper
- RasterSurfaceOp
- RasterModel
- GridTableOp
- Enabling the Spatial Analyst license
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:
- Obtain a Spatial Analyst or 3D Analyst extension license.
- Set the analysis environment.
- Access the input data.
- Perform an operation.
- 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:
- Clip—Cuts out a rectangular portion of a raster.
- Flip—Flips the raster along the horizontal axis.
- Mirror—Mirrors the raster along the vertical axis.
- Mosaic—Creates one raster from multiple input rasters using a user-selectable method to deal with overlapping areas of the neighboring rasters.
- ProjectFast—Projects a raster to a new spatial reference using the esriGeoAnalysisResampleEnum enumerator, which allows you to pick a nearest, bilinear, or cubic resampling technique.
- Resample—Resamples a raster to a new cell size.
- Rescale—Scales a raster by the specified x,y scale factors.
- Rotate—Rotates a raster around the specified pivot point by an angle specified in degrees.
- Shift—Shifts a raster in the x,y direction by specifying the respective distances.
- Warp—Transforms or rubber sheets a raster along a set of links using a polynomial transformation.
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:
- MakeConstant—Creates a dataset that consists of a single integer or floating point value.
- MakeNormal—Creates a raster of random values from a normal distribution with a mean of 0 and a standard deviation of 1.
- MakeRandom—Creates a raster that consists of random numbers between 0 and 1 with the choice of specifying an optional seed value.
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:
- Lookup—Creates a new raster by looking up values in another field in the table of the input raster.
- Reclass—Reclassifies, or changes, the values in a raster.
- ReclassByASCIIFile—Reclassifies the value of the input cells of a raster by using an ASCII remap file.
- ReclassByRemap—Reclassifies 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—"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
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:
- SetAnnulus—Defines the region lying between two concentric circles to be used as a neighborhood.
- SetDefault—Creates a 3 by 3 neighborhood.
- SetIrregular—Sets a neighborhood object whose entries can be turned on or off.
- SetWeight—Sets a neighborhood object whose entries can be assigned a weight. It 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
The IInterpolationOp interface gives you access to the following methods:
- IDW—Inverses distance weighted interpolation on a point feature dataset.
- Krige—Interpolates a surface from a set of points using kriging.
- Spline—Interpolates a surface from a set of points using a minimum curvature spline technique.
- Trend—Performs a trend interpolation on a point data set.
- Variogram—Similar to the Krige method except that it allows you to specify additional kriging parameters pertaining to the semivariogram. This is done through the GeoAnalysisSemiVariogram class.
The IInterpolationOp2 interface gives you access to the following additional methods:
- NaturalNeighbor—Creates a surface from points using a natural neighbor interpolation technique.
- TopoToRasterByFile—Generates a hydrologically correct raster of elevation values from point, line, and polygon datasets.
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:
- Aspect—Identifies the direction of flow and maximum rate of change in z values from each cell.
- Contour—Creates contours or isolines from a raster surface.
- ContourAsPolyline—Creates contours or isolines that pass through a specified point on a surface.
- ContourList—Creates contours or isolines based on a list of contour values.
- Curvature—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, thereby influencing erosion and deposition. The planform curvature influences convergence and divergence of flow.
- CutFill—Creates output with volume information describing surface changes after a cut-and-fill operation.
- HillShade—Creates a shaded relief raster from a raster by considering the illumination angle and shadows.
- Slope—Identifies the rate of maximum change in z values from each cell.
- Visibility—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
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:
- Prior to accessing each GeoAnalyst object
- Once in a single method
- Once globally in the main routine of a program
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;
}