This document is archived and information here might be outdated.  Recommended version.


How to create an AdjustXform for georeferencing images (ArcObjects .NET 10.5 SDK)

How to create an AdjustXform for georeferencing images


Creating an AdjustXform for georeferencing images

Adjust (or rubbersheeting) transformation is one of the geometric transformation types supported in ArcGIS software. The user interface can be accessed through the Georeferencing toolbar in ArcMap.
The following code example shows how to create an AdjustXform from two sets of control points. The AdjustXform can then be set to a raster, which will transform the raster geometrically.
[C#]
public IAdjustXform CreateAdjustXform(IPointCollection sourcePoints,
    IPointCollection targetPoints, ISpatialReference sr)
{
    //This example creates an AdjustXform.
    IAdjustXform adjustXF=new AdjustXformClass();

    //Set control points and the polynomial order used.
    adjustXF.DefineFromControlPoints(sourcePoints, targetPoints);
    adjustXF.PolynomialApproximation=2;

    //Use interpolation to do the adjustment.
    adjustXF.NaturalNeighbor=true;

    //You can also define the spatial reference of the Xform.
    adjustXF.SpatialReference=sr;
    return adjustXF;
}
[VB.NET]
Public Function CreateAdjustXform(ByVal sourcePoints As IPointCollection, ByVal targetPoints As IPointCollection, ByVal sr As ISpatialReference) As IAdjustXform
    'This example creates an AdjustXform.
    Dim adjustXF As IAdjustXform=New AdjustXformClass()
    
    'Set control points and the polynomial order used.
    adjustXF.DefineFromControlPoints(sourcePoints, targetPoints)
    adjustXF.PolynomialApproximation=2
    
    'Use interpolation to do the adjustment.
    adjustXF.NaturalNeighbor=True
    
    'You can also define the spatial reference of the Xform.
    adjustXF.SpatialReference=sr
    
    Return adjustXF
End Function


See Also:

How to perform a geodata transformation on a raster




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