C#+arcengine获得栅格数据

    ///
        /// 加载raster
        ///

        /// raster的路径+名称
        ///
        private IRaster GetRaster(string Path)
        {
            try
            {
                int iindx = Path.LastIndexOf("\\");
                string suffixRasterName = (Path.Substring(iindx + 1));/raster的名称
                string rasterPath = Path.Remove(iindx);//raster的路径
                IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactoryClass();
                IWorkspace workspace = workspaceFactory.OpenFromFile(rasterPath, 0);
                IRasterWorkspace rasterWorkspace = (IRasterWorkspace)workspace;
                IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset(suffixRasterName);
                IRaster raster = rasterDataset.CreateDefaultRaster();
                return raster;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return null;
            }
        }

你可能感兴趣的:(C#+Arcengine)