swazerz 2019-10-22
// 创建栅格工作空间. IWorkspaceFactory workspaceFactory=new RasterWorkspaceFactory(); // 打开指向输入文件夹的工作空间. IWorkspace workspace=workspaceFactory.OpenFromFile(@"c:\FRDs", 0); IRasterWorkspace rasterWorkspace=(IRasterWorkspace)workspace; // 打开.afr 文件为栅格数据集. IRasterDataset myRasterDataset=rasterWorkspace.OpenRasterDataset( "CompositeBand.afr"); // 打开指向输出文件夹的工作空间. IWorkspace outputWorkspace=workspaceFactory.OpenFromFile(@"c:\temp", 0); // 使用 SaveAs 接口将栅格数据集转换为 ISaveAs 对象. ISaveAs saveAsRaster=(ISaveAs)myRasterDataset; // 使用SaveAs方法保存为指定格式的栅格数据集. saveAsRaster.SaveAs("outputFile.tif", outputWorkspace, "tiff");