How to project a raster with a datum transformation

Projecting a raster with a datum transformation

When projecting raster data, you can specify a geotransformation if the spatial references of the input and output are based on different datums. See the following code example:
static void projectRasterWithDatumTransformation(IRasterDataset2 rasterDataset,
    ISpatialReference outSR, int geoTrans)throws Exception{
    //This examples shows how to specify a datum transfomration when projecting raster data
    //rasterDataset: represents input a raster dataset that has a known spatial reference
    //outSR: represents the spatial reference of the output raster dataset
    //geoTrans: reprepresents the geo transformation between the input and output spatial reference
    //set output spatial reference

    IRaster raster = rasterDataset.createFullRaster();
    IRasterProps rasterProps = new IRasterPropsProxy(raster);

    //spacify the geo transformation
    ISpatialReferenceFactory2 srFactory = new SpatialReferenceEnvironment();
    IGeoTransformation geoTransformation = (IGeoTransformation)

    //Add to the geo transformation operation set
    IGeoTransformationOperationSet operationSet = new GeoTransformationOperationSet()
    operationSet.set(esriTransformDirection.esriTransformForward, geoTransformation);
    operationSet.set(esriTransformDirection.esriTransformReverse, geoTransformation);

    //set the geotransformation on the Raster
    IRaster2 raster2 = new IRaster2Proxy(raster);

    //save the result  
    ISaveAs saveas = new ISaveAsProxy(raster);
    saveas.saveAs("c:/temp/outputRaster.img", null, "IMAGINE Image");

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