How to create an ApproximationXform


Summary
This topic shows how to create an ApproximationXform class. An ApproximationXform class can be used to approximate a geodata transformation, which is computationally expensive, to improve the transformation speed.

Creating an ApproximationXform

The AppriximateXform uses a defined grid to approximate the GeodataXform. The following code example defines a grid of 32 x 32 pixels and a tolerance of 10. Rather than calculating transformation for each pixel, this ApproximateXform calculates on the grid if the error is within the defined tolerance and subdivides the grid if the error is larger than the tolerance.
[C#]
public IApproximationXform CreateApproximateXform(IGeodataXform xform)
{
    //Create an approximation of xform.
    IApproximationXform approximateXform = new ApproximationXformClass();
    approximateXform.GeodataXform = xform;

    //Define the approximation parameters.
    IGeodataXformApproximation geodataXformApproximation = 
        (IGeodataXformApproximation)approximateXform;
    geodataXformApproximation.GridSize = 32;
    geodataXformApproximation.Approximation = true;
    geodataXformApproximation.Tolerance = 10; //Unit is in the input space.
    return approximateXform;
}
[VB.NET]
Public Function CreateApproximateXform(ByVal xform As IGeodataXform) As IApproximationXform
    'Create an approximation of xform.
    Dim approximateXform As IApproximationXform = New ApproximationXformClass()
    approximateXform.GeodataXform = xform
    
    'Define the approximation parameters.
    Dim geodataXformApproximation As IGeodataXformApproximation = CType(approximateXform, IGeodataXformApproximation)
    geodataXformApproximation.GridSize = 32
    geodataXformApproximation.Approximation = True
    geodataXformApproximation.Tolerance = 10 'Unit is in the input space.
    Return approximateXform
End Function






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 for Desktop Advanced
ArcGIS for Desktop Advanced ArcGIS for Desktop Standard
ArcGIS for Desktop Standard ArcGIS for Desktop Basic
ArcGIS for Desktop Basic Engine
Engine Developer Kit