• 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;
                    }
  • 相关阅读:
    程序编译的四个阶段
    c++的符号表的肤浅认识
    git高级用法之cheery-pick
    rust 使用国内镜像,快速安装方法
    protobuf 的enum与string转换
    c++ 获取GMT 时间和字符串
    proto3 不支持内建类型的非空判断即 hasXXX
    cmake 中的 compile_commands.json 文件
    整数划分问题(记忆化搜索和DP方法)
    查找系列合集-二分查找
  • 原文地址:https://www.cnblogs.com/imihiroblog/p/2506813.html
Copyright © 2020-2023  润新知