Creating a Trend function dataset
To create a Trend function dataset, follow these steps:
- Create the Function Arguments object.
- Set the parameters for the plane surface for each band.
- Create a Raster Function object.
- Create a Function Raster Dataset object.
- Create a name object for the function raster dataset.
- Specify the output file name for the new dataset.
- Initialize the new function raster dataset with the raster function and its arguments.
The following code example shows how to create a Trend function raster dataset by applying the Trend raster function to an image:
[C#] // Set the parameters for the plane surface for each band as an array of doubles.
IDoubleArray planeParams=new DoubleArray();
planeParams.Add(0.003404983);
planeParams.Add(0.002619746);
planeParams.Add(2727.508772);
planeParams.Add(1436.192982);
planeParams.Add( - 4.34660937);
planeParams.Add( - 0.001017467);
planeParams.Add(0.000737566);
planeParams.Add(2727.508772);
planeParams.Add(1436.192982);
planeParams.Add(3.380154490);
planeParams.Add(0.006902156);
planeParams.Add(0.004277072);
planeParams.Add(2727.508772);
planeParams.Add(1436.192982);
planeParams.Add( - 22.5181115);
// Create the Function Arguments object.
ITrendFunctionArguments rasterFunctionArguments=(ITrendFunctionArguments)new
TrendFunctionArguments();
rasterFunctionArguments.PlaneParameters=planeParams;
// The input data can be of type IRasterDataset, IRasterBand, or IRaster.
rasterFunctionArguments.Raster=inputData;
// Create the Raster Function object.
IRasterFunction rasterFunction=new TrendFunction();
// Create the Function Raster Dataset object.
IFunctionRasterDataset functionRasterDataset=new FunctionRasterDataset();
// Create a name object for the Function Raster Dataset.
IFunctionRasterDatasetName functionRasterDatasetName=(IFunctionRasterDatasetName)
new FunctionRasterDatasetName();
// Specify the output file name for the new dataset (including the .afr extension at the end).
functionRasterDatasetName.FullName=@"c:\temp\TrendFunction.afr";
functionRasterDataset.FullName=(IName)functionRasterDatasetName;
// Initialize the new Function Raster Dataset with the Raster Function and its arguments.
functionRasterDataset.Init(rasterFunction, rasterFunctionArguments);
[VB.NET] ' Set the parameters for the plane surface for each band as an array of doubles.
Dim planeParams As IDoubleArray
planeParams=New DoubleArray()
planeParams.Add(0.003404983)
planeParams.Add(0.002619746)
planeParams.Add(2727.508772)
planeParams.Add(1436.192982)
planeParams.Add( -4.34660937)
planeParams.Add( -0.001017467)
planeParams.Add(0.000737566)
planeParams.Add(2727.508772)
planeParams.Add(1436.192982)
planeParams.Add(3.38015449)
planeParams.Add(0.006902156)
planeParams.Add(0.004277072)
planeParams.Add(2727.508772)
planeParams.Add(1436.192982)
planeParams.Add( -22.5181115)
Dim rasterFunctionArguments As ITrendFunctionArguments
rasterFunctionArguments=New TrendFunctionArguments()
rasterFunctionArguments.PlaneParameters=planeParams
' The input data can be of type IRasterDataset, IRasterBand, or IRaster.
rasterFunctionArguments.Raster=inputData
' Create the Raster Function object.
Dim rasterFunction As IRasterFunction
rasterFunction=New TrendFunction()
' Create the Function Raster Dataset object.
Dim functionRasterDataset As IFunctionRasterDataset
functionRasterDataset=New FunctionRasterDataset()
' Create a name object for the Function Raster Dataset.
Dim functionRasterDatasetName As IFunctionRasterDatasetName
functionRasterDatasetName=New FunctionRasterDatasetName()
' Specify the output file name for the new dataset (including the .afr extension at the end).
functionRasterDatasetName.FullName="c:\temp\TrendFunction.afr"
functionRasterDataset.FullName=functionRasterDatasetName
' Initialize the new Function Raster Dataset with the Raster Function and its arguments.
functionRasterDataset.Init(rasterFunction, rasterFunctionArguments)
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):
- ESRI.ArcGIS.DataSourcesRaster
- ESRI.ArcGIS.Geodatabase
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
Development licensing | Deployment licensing |
---|---|
ArcGIS Desktop Advanced | ArcGIS Desktop Advanced |
ArcGIS Desktop Standard | ArcGIS Desktop Standard |
ArcGIS Desktop Basic | ArcGIS Desktop Basic |