[arcengine][栅格]保存为本地文件

功能:保存栅格到本地
版本:10.2

/// 
        /// 保存栅格到本地
        /// 
        /// IRaster
        /// 本地路径全名
        /// 0:成功 !=0:失败
        private int RasterSaveAs(IRaster raster, string fileName)
        {
            int result = 0;
            try
            {
                IWorkspaceFactory pWKSF = new RasterWorkspaceFactoryClass();
                IWorkspace pWorkspace = pWKSF.OpenFromFile(System.IO.Path.GetDirectoryName(fileName), 0);
                ISaveAs pSaveAs = raster as ISaveAs;
                pSaveAs.SaveAs(System.IO.Path.GetFileName(fileName), pWorkspace, "TIFF");
                result = 0;
            }
            catch (Exception ex)
            {
                result = 1;
            }
            return result;
        }

你可能感兴趣的:(ArcGIS,Engine,开发)