SDE open rastercatalog,遍历rasterCatalog下的所有RasterDataset
IRasterWorkspaceEx pRasterWex=Utilities.OpenSDERasterWSEx();//访问SDE 中的 RasterCatalog
//连接SDE 中的RasterCatalog
public static IRasterWorkspaceEx OpenSDERasterWSEx() { ESRILicense();//LicenseProduce.Engine 此方法通过. //LicenseProduct.EngienGeoDB 此方法异常 IPropertySet propertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass(); propertySet.SetProperty("SERVER", Configuration.SdeServer); propertySet.SetProperty("INSTANCE", Configuration.SdeInstance); propertySet.SetProperty("DATABASE", Configuration.SdeDataBase); propertySet.SetProperty("USER", Configuration.SdeUser); propertySet.SetProperty("PASSWORD", Configuration.SdePassword); propertySet.SetProperty("VERSION", Configuration.SdeVersion); IWorkspaceFactory pWsFact = new SdeWorkspaceFactory(); IRasterWorkspaceEx pWs = pWsFact.Open(propertySet, 0) as IRasterWorkspaceEx; return pWs; }
//遍历RasterCatalog中的所有rasterDataset
IRasterCatalog rasterCatalog= pRasterWex.OpenRasterCatalog(Configuration.SdeRasterCatalog);//遍历RasterCatalog下的所有rasterDataset ITable table = rasterCatalog as ITable; ICursor cursor = table.Search(null,false); IRow row = cursor.NextRow(); List<IRasterDataset> li_Rasters = new List<IRasterDataset>();//遍历RasterCatalog将所有rasterds添加进去 while(row != null) { IRasterCatalogItem rasterCatalogItem = row as IRasterCatalogItem; IRasterDataset rasterDataset = rasterCatalogItem.RasterDataset; li_Rasters.Add(rasterDataset); row = cursor.NextRow(); }
//RasterCatalog:
存储一组空间参考相同的RasterDataset. RasterCatalog相当于featureclass+raster字段和shape字段,RasterCatalog下的每个RasterDataset相当于一个feature
参考:RasterCatalog ...搜索中的
//以FeatureClass来处理RasterCatalog
IRasterWorkspaceEx pRasterWex=Utilities.OpenSDERasterWSEx();//访问SDE 中的 RasterCatalog IRasterCatalog rasterCatalog= pRasterWex.OpenRasterCatalog(Configuration.SdeRasterCatalog);//遍历RasterCatalog下的所有rasterDataset IPolyline pPart = new PolylineClass();//相交部分的线 IFeatureClass pfc = rasterCatalog as IFeatureClass; IFeatureCursor pfcc = pfc.Search(null, false); IFeature pf = pfcc.NextFeature(); while(pf!=null) { bool partialintersect = false; IRasterCatalogItem rasterCatalogItem = pf as IRasterCatalogItem; IRaster pRaster = rasterCatalogItem.RasterDataset.CreateDefaultRaster();// string rastername = pf.get_Value(pf.Fields.FindField("Name")).ToString();//RasterDataset的名称 if (rastername == Configuration.BottomRaster) //如果是最底图层 { pf = pfcc.NextFeature(); continue; }