在使用ArcEngine调用ISaveAs2 saveas方法将栅格保存为TIFF,总是会出现问题,一般与路径有关,可以改用IRasterLayerExport3接口,示例代码如下:
IRasterLayerExport3 rasterLyrExport = new RasterLayerExportClass();
IRasterLayer rasterLayer = new RasterLayerClass();
rasterLayer.CreateFromRaster(raster);
rasterLyrExport.RasterLayer = rasterLayer;
rasterLyrExport.Force2RGB = false;IRasterDataset rasterDataset = rasterLyrExport.Export(workspace, System.IO.Path.GetFileName(filePath), format);Marshal.ReleaseComObject(rasterDataset);
IRasterLayerExport3 rasterLyrExport = new RasterLayerExportClass();
IRasterLayer rasterLayer = new RasterLayerClass();
rasterLayer.CreateFromRaster(raster);
rasterLyrExport.RasterLayer = rasterLayer;
rasterLyrExport.Force2RGB = false;IRasterDataset rasterDataset = rasterLyrExport.Export(workspace, System.IO.Path.GetFileName(filePath), format);Marshal.ReleaseComObject(rasterDataset);