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


How to orthorectify an image (ArcObjects .NET 10.5 SDK)

How to orthorectify an image


Orthorectifying an image

The following code example reads a rational polynomial coefficient (RPC) image and performs orthorectification using a digital elevation model (DEM):
[C#]
public static void OrthorectifyImage(IRasterDataset2 rpcDataset, IRasterDataset
    demDataset)
{
    //rpcDataset—Represents a raster dataset that has RPC information.
    //demDataset—Represents a raster dataset opened from a DEM of the same area.

    //Get the RPCXform from the raster dataset.
    IRaster2 raster=(IRaster2)rpcDataset.CreateFullRaster();
    IGeodataXform rpcXform=raster.GeodataXform;

    //Set the DEM, and so on.
    ISensorXform sensor=(ISensorXform)rpcXform;
    sensor.DEM=demDataset.CreateDefaultRaster();
    sensor.CorrectGeoid=true;

    //Save the result.
    ISaveAs saveas=(ISaveAs)raster;
    saveas.SaveAs(@"c:\temp\orthorectify_output.img", null, "IMAGINE Image");
}
[VB.NET]
Public Shared Sub OrthorectifyImage(ByVal rpcDataset As IRasterDataset2, ByVal demDataset As IRasterDataset)

'rpcDataset—Represents a raster dataset that has RPC information.
'demDataset—Represents a raster dataset opened from a DEM of the same area.

'Get the RPCXform from the raster dataset.
Dim raster As IRaster2=CType(rpcDataset.CreateFullRaster(), IRaster2)
Dim rpcXform As IGeodataXform=raster.GeodataXform

'Set the DEM, and so on.
Dim sensor As ISensorXform=CType(rpcXform, ISensorXform)
sensor.DEM=demDataset.CreateDefaultRaster()
sensor.CorrectGeoid=True

'Save the result.
Dim saveas As ISaveAs=CType(raster, ISaveAs)
saveas.SaveAs("c:\temp\orthorectify_output.img", Nothing, "IMAGINE Image")

End Sub






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