• AE+C# 实现MERGE, AE实现相同结构图层的合并C#代码(转载)


    AE+C# 实现MERGE

                ILayer pLayer;
                IFeatureLayer pFeatureLayer;
                IFeatureClass pFeatureClass;
                IWorkspaceName pNewWSName;
                IBasicGeoprocessor pBasicGeop;
                IFeatureClassName pFeatureClassName;
                IDatasetName pDatasetName;
                IFeatureClass pOutputFeatClass;
                IFeatureLayer pOutputFeatLayer;
                IArray pArray;
                ITable pTable;
                //合并图层的集合
                pArray = new ArrayClass();
                for (int i = 0; i < this.axMapcontrol1.LayerCount;i++ )
                {
                    pLayer = this.MapC_main.get_Layer(i);
                    pArray.Add(pLayer);
                }
                //定义输出图层的fields表
                pLayer = this.MapC_main.get_Layer(0);
                pTable = (ITable)pLayer;
                pFeatureLayer=(IFeatureLayer)pLayer;
                pFeatureClass = pFeatureLayer.FeatureClass;
                //判断图层是否大于2个
                if(this..axMapcontrol1.LayerCount< 2){
                    MessageBox.Show("Table QI failed");
                    return;
                }
                //输出文件类型
                pFeatureClassName = new FeatureClassNameClass();
                pFeatureClassName.FeatureType = esriFeatureType.esriFTSimple;
                pFeatureClassName.ShapeFieldName = "Shape";
                pFeatureClassName.ShapeType = pFeatureClass.ShapeType;
                //输出shapefile的名称和位置
                pNewWSName = new WorkspaceNameClass();
                pNewWSName.WorkspaceFactoryProgID="esriDataSourcesFile.ShapefileWorkspaceFactory";
                pNewWSName.PathName = "E:\\Cshape";
                pDatasetName = (IDatasetName)pFeatureClassName;
                pDatasetName.Name = "Union_result_1";
                pDatasetName.WorkspaceName = pNewWSName;
                
                //合并图层
                pBasicGeop = new BasicGeoprocessorClass();
                pOutputFeatClass=pBasicGeop.Merge(pArray,pTable,pFeatureClassName);
                //Add the output layer to the map
                pOutputFeatLayer = new FeatureLayerClass();
                pOutputFeatLayer.FeatureClass = pOutputFeatClass;
                pOutputFeatLayer.Name = pOutputFeatClass.AliasName;
                this..axMapcontrol1.AddLayer(pOutputFeatLayer as ILayer, 0);

    转自:http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=27749&extra=page%3D3

            

    The WorkspaceFactoryProgID identifies the ProgID of the WorkspaceFactory object that is used to open that particular workspace.

    Here is a list of some of the possible WorkspaceFactoryProgIDs:

    • esriDataSourcesGDB.AccessWorkspaceFactory
    • esriDataSourcesFile.ArcInfoWorkspaceFactory
    • esriDataSourcesFile.CadWorkspaceFactory
    • esriDataSourcesGDB.FileGDBWorkspaceFactory
    • esriDataSourcesOleDB.OLEDBWorkspaceFactory
    • esriDataSourcesFile.PCCoverageWorkspaceFactory
    • esriDataSourcesRaster.RasterWorkspaceFactory
    • esriDataSourcesGDB.SdeWorkspaceFactory
    • esriDataSourcesFile.ShapefileWorkspaceFactory
    • esriDataSourcesOleDB.TextFileWorkspaceFactory
    • esriDataSourcesFile.TinWorkspaceFactory
    • esriDataSourcesFile.VpfWorkspaceFactory
  • 相关阅读:
    5种Python使用定时调度任务的方式
    基于Tensorflow + Opencv 实现CNN自定义图像分类
    CANN 5.0硬核技术抢先看
    大力出奇迹,揭秘昇腾CANN的AI超能力
    MSQL:超强的多任务表示学习方法
    Shell:Lite OS在线调试工具知多少
    带你掌握Vue过滤器filters及时间戳转换
    Selenium系列(六) 详细解读强制等待、隐式等待、显式等待的区别和源码解读
    Linux常用命令 top命令详解(重点)
    Selenium系列(一) 详细解读8种元素定位方式
  • 原文地址:https://www.cnblogs.com/wuhenke/p/1656276.html
Copyright © 2020-2023  润新知