How to perform geodata transformation on a raster

This document shows how to set a transformation on a raster.

Performing geodata transformation on a raster

A geodata transformation is a mathematical model that performs geometric transformation on a raster. The geodata transformation consists of many concrete classes such as, PolynomialXform, RPCXform, AdjustXform, and so on.
To perform geodata transformation on a raster, you need to set it on the raster first, then set the output extent and cell size. See the following:
static void setGeodataXformAndSaveAs(IRaster2 raster, IGeodataXform xform)throws
    //Get the original extent and cell size of the raster.
    IRasterProps rasterProp = (IRasterProps)raster;
    IEnvelope extent = rasterProp.getExtent();
    IPnt cellSize = rasterProp.meanCellSize();
    double[] xCell = {
    double[] yCell = {

    //Set the xform on the raster.

    //Transform the cell size first, then the extent; the sequence matters.
    xform.transformCellsize(esriTransformDirection.esriTransformForward, xCell,
        yCell, extent);
    xform.transformExtent(esriTransformDirection.esriTransformForward, extent);

    //Put the transformed extent and cell size on the raster and save as.
    rasterProp.setWidth((int)(extent.getWidth() / xCell[0]));
    rasterProp.setHeight((int)(extent.getHeight() / yCell[0]));

    //Save the raster.
    ISaveAs saveAs = new ISaveAsProxy(raster);
    saveAs.saveAs("c:/temp/image1.img", null, "IMAGINE Image");

Development licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine