ラスター データセットの簡易投影変換

// http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/d/0001000002n7000000.htm

public static void run()
{
    string appPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase; //ラスター ワークスペース
    
    IWorkspaceFactory pRasterWorkspaceFactory;
    pRasterWorkspaceFactory = new RasterWorkspaceFactoryClass();
    
    IRasterWorkspace pRasterWorkspace = (IRasterWorkspace)pRasterWorkspaceFactory.OpenFromFile(appPath, 0); //raster workspace
    
    IRasterDataset2 pRasterDataset;
    pRasterDataset = (IRasterDataset2)pRasterWorkspace.OpenRasterDataset("dem5m_23ku_prj1.tif"); // raster dataset
    
    //Raster の作成
    IRaster pRaster;
    pRaster = pRasterDataset.CreateFullRaster();
    
    //空間参照の作成
    System.Type t =  System.Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
    ISpatialReferenceFactory srFacgtory = (ISpatialReferenceFactory)System.Activator.CreateInstance(t);
    ISpatialReference pResWgs1984 = (ISpatialReference)srFacgtory.CreateGeographicCoordinateSystem(4326);
    
    
    //セルサイズの設定
    double cellSize =0.01;
    IRasterGeometryProc pRasterPropc = new RasterGeometryProcClass();
    
    //投影変換
    //pRasterPropc.ProjectFast(pResWgs1984, rstResamplingTypes.RSP_NearestNeighbor, (object)cellSize, pRaster); //第3引数に double 型をセットする方法でも指定可能
    pRasterPropc.ProjectFast(pResWgs1984, rstResamplingTypes.RSP_NearestNeighbor, Type.Missing, pRaster);
    
    IGeoDataset pGeoDataset = (IGeoDataset)pRaster;
    IEnvelope extent = pGeoDataset.Extent;

    
    //出力ラスターの高さと幅の設定
    int col = Convert.ToInt32((extent.XMax - extent.XMin) / cellSize);
    int row = Convert.ToInt32((extent.YMax - extent.YMin) / cellSize);
    
    //範囲の設定
    IPoint lowerLeft = extent.LowerLeft;
    IPoint UpperRight = new PointClass();
    IEnvelope newExtent = new EnvelopeClass();
    UpperRight.X = lowerLeft.X + col * cellSize;
    UpperRight.Y = lowerLeft.Y + row * cellSize;
    newExtent.LowerLeft = lowerLeft;
    newExtent.UpperRight = UpperRight;
    
    //範囲の指定
    IRasterProps rasterProps = (IRasterProps)pRaster;
    rasterProps.Extent = newExtent;
    rasterProps.Height = row;
    rasterProps.Width = col;
    
    //保存
    ISaveAs saveAs = rasterProps as ISaveAs;
    saveAs.SaveAs( appPath + @"\image1.tif", null, "TIFF"); //出力ファイル名
    
    Console.WriteLine("Done");
    Console.ReadKey();
    
}