Exemple #1
0
        /// <summary>
        /// 栅格保存为数据集(并创建金字塔)
        /// </summary>
        /// <param name="raster">栅格</param>
        /// <param name="outFile">输出文件</param>
        public static void SaveRasterAsDataset(IRaster raster, string outFile)
        {
            //文件已存在,则返回
            if (File.Exists(outFile) || raster == null)
            {
                return;
            }

            IRasterBandCollection pRasBandCol = raster as IRasterBandCollection;

            if (pRasBandCol == null)
            {
                return;
            }
            string     fileName  = Path.GetFileName(outFile);
            IWorkspace workspace = RasterDataInfoClass.GetRasterWorkspace(outFile);
            //保存波段集合为数据集
            IDataset          dataset = pRasBandCol.SaveAs(fileName, workspace, "IMAGINE Image");
            ITemporaryDataset pRsGeo  = dataset as ITemporaryDataset;

            if (pRsGeo != null && pRsGeo.IsTemporary())
            {
                pRsGeo.MakePermanent();
            }

            RasterDataInfoClass.CreatePyramid(outFile); //创建金字塔
        }
Exemple #2
0
        /// <summary>
        /// 设置栅格分析环境的输出空间为临时文件夹
        /// </summary>
        /// <param name="rasterAnalysisEnvironment">栅格分析环境</param>
        public static void SetRasterAnalysisOutWorkspace(IRasterAnalysisEnvironment rasterAnalysisEnvironment)
        {
            if (rasterAnalysisEnvironment == null)
            {
                return;
            }
            //获取临时目录
            string     finalTemPath = TempFile.CreateNewTempDirectory();
            IWorkspace workspace    = RasterDataInfoClass.GetRasterWorkspace(finalTemPath);

            //设置输出工作空间
            rasterAnalysisEnvironment.OutWorkspace = workspace;
        }