阅读:1353回复:0
上传影像,ArcCatalog无法查看TIF文件
如下,在ArcCatalog里能看见新建的Dataset,但影像信息却为空,不能浏览,是什么原因啊,大家帮帮忙,谢谢<BR><BR>string tifPath = "";<BR>OpenFileDialog flg = new OpenFileDialog();<BR>flg.Title = "打开文件数据";<BR>flg.CheckFileExists = true;<BR>flg.CheckPathExists = true;<BR>flg.AddExtension = true;<BR>flg.Multiselect = false;<BR>flg.Filter = "TIFF文件(.tif) | *tif";<BR>if (flg.ShowDialog() == DialogResult.Cancel)<BR>return;<BR>tifPath = flg.FileName;<BR><BR>string ImportFileShortName = System.IO.Path.GetFileNameWithoutExtension(tifPath);<BR>string ImportFilePath = System.IO.Path.GetDirectoryName(tifPath);<BR><BR>IBasicRasterSdeConnection pSDEConn = new BasicRasterSdeLoader();<BR>pSDEConn.ServerName = "172.18.6.2";<BR>pSDEConn.Instance = "5151";<BR>pSDEConn.Database = "orcl";<BR>pSDEConn.UserName = "sde";<BR>pSDEConn.Password = "sde";<BR>string path = ImportFilePath + "\\" + ImportFileShortName + ".tif";<BR>pSDEConn.InputRasterName = path;<BR>pSDEConn.SdeRasterName = ImportFileShortName;<BR><BR>IWorkspaceFactory pRasterWsFact = new RasterWorkspaceFactoryClass();<BR>IWorkspace workspace = pRasterWsFact.OpenFromFile(ImportFilePath, 0);<BR>IRasterWorkspace pRasterWs = (IRasterWorkspace)workspace;<BR>//string input = "SDE." + ImportFileShortName;<BR>IRasterDataset pRasterDs = pRasterWs.OpenRasterDataset(ImportFileShortName + ".tif");<BR>IGeoDataset pGeoDs = (IGeoDataset)pRasterDs;<BR>ISpatialReference spref = pGeoDs.SpatialReference;<BR>//设置存储属性<BR>IRasterSdeStorage pSDEStorage = (IRasterSdeStorage)pSDEConn;<BR>//设置空间参考<BR>pSDEStorage.SpatialReference = spref;<BR>//设置压缩方式<BR>pSDEStorage.CompressionType = esriRasterSdeCompressionTypeEnum.esriRasterSdeCompressionTypeRunLength;<BR>//设置分块尺寸<BR>pSDEStorage.TileHeight = 128;<BR>pSDEStorage.TileWidth = 128;<BR>//金字塔选项<BR>pSDEStorage.PyramidOption = esriRasterSdePyramidOptEnum.esriRasterSdePyramidBuildWithFirstLevel;//RSP_BilinearInterpolation;<BR>pSDEStorage.PyramidResampleType = 0;<BR>//开始导入数据<BR>pSDEConn.MaskRaster = pRasterDs.CreateDefaultRaster();<BR>IRasterSdeServerOperation pSDEOp = (IRasterSdeServerOperation)pSDEConn;<BR><BR>//创建数据集<BR>pSDEOp.Create();<BR>pSDEOp.BuildPyramids();<BR>pSDEOp.ComputeStatistics();<BR>
|
|