How to create a Local Function raster dataset (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > ArcGIS extensions > Spatial Analyst > How to create a Local Function raster dataset (ArcObjects .NET 10.6 SDK)

How to create a Local Function raster dataset


Creating a Local Function raster dataset

Do the following steps to create a Local Function raster dataset:
  1. Create the Local Function object.
  2. Create the Local Function Arguments object.
  3. Set the properties for the local function arguments.
    1. Specify the operation.
    2. Specify the input raster array.
  4. Create a Raster Function object.
  5. Create a Function Raster dataset object.
  6. Initialize the new function raster dataset with the raster function and its arguments.
The following code example shows how to create a Local Function raster dataset by calculating the maximum value (per-cell statistic) from multiple input rasters. Additionally, the cell size of the output raster is being set.
[C#]
//Create the Raster Function object and the Function Arguments object.
IRasterFunction rasterFunction=new LocalFunction();
ILocalFunctionArguments localFunctionArguments=new LocalFunctionArguments()as
    ILocalFunctionArguments;

//Specify the operation to be the "maximum cell value of the inputs."
localFunctionArguments.Operation =
    esriGeoAnalysisFunctionEnum.esriGeoAnalysisFunctionMax;

//Open raster datasets and specify input rasters to the operation as an array.
IArray array1=new ESRI.ArcGIS.esriSystem.Array();
array1.Add(inRasterDataset01);
array1.Add(inRasterDataset02);
array1.Add(inRasterDataset03);
localFunctionArguments.Rasters=array1;

//Create the Raster Info object and set the cell size for the analysis.
IRasterInfo rasInfo=new RasterInfo();
IPnt pnt1=new Pnt();
pnt1.X=2;
pnt1.Y=2;
rasInfo.CellSize=pnt1;
localFunctionArguments.RasterInfo=rasInfo;

//Create and initialize a Function raster dataset with the Raster Function object and its arguments.
IFunctionRasterDataset functionRasterDataset;
functionRasterDataset=new FunctionRasterDataset();
functionRasterDataset.Init(rasterFunction, localFunctionArguments);
[VB.NET]
'Create the Raster Function object and the Function Arguments object.
Dim rasterFunction As IRasterFunction
rasterFunction=New LocalFunction()
Dim localFunctionArguments As ILocalFunctionArguments
localFunctionArguments=New LocalFunctionArguments()

'Specify the operation to be the "maximum cell value of the inputs."
localFunctionArguments.Operation=esriGeoAnalysisFunctionEnum.esriGeoAnalysisFunctionMax

'Open raster datasets and specify input rasters to the operation as an array.
Dim array1 As IArray
array1=New ESRI.ArcGIS.esriSystem.Array()
array1.Add(inRasterDataset01)
array1.Add(inRasterDataset02)
array1.Add(inRasterDataset03)
localFunctionArguments.Rasters=array1

'Create the Raster Info object, and set the cell size for the analysis.
Dim rasInfo As IRasterInfo
rasInfo=New RasterInfo()
Dim pnt1 As IPnt
pnt1=New Pnt()
pnt1.X=2
pnt1.Y=2
rasInfo.CellSize=pnt1
localFunctionArguments.RasterInfo=rasInfo

'Create and initialize a Function raster dataset with the Raster Function object and its arguments.
Dim functionRasterDataset As IFunctionRasterDataset
functionRasterDataset=New FunctionRasterDataset()
functionRasterDataset.Init(rasterFunction, localFunctionArguments)


See Also:

How to create a Conditional Function raster dataset
How to create a Math Function raster dataset
How to save a Function raster dataset into a raster dataset
How to access a raster dataset
Samples:




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Advanced: Spatial Analyst ArcGIS Desktop Advanced: Spatial Analyst
ArcGIS Desktop Standard: Spatial Analyst ArcGIS Desktop Standard: Spatial Analyst
ArcGIS Desktop Basic: Spatial Analyst ArcGIS Desktop Basic: Spatial Analyst