zoukankan      html  css  js  c++  java
  • arcengine 调用arctoolbox功能的举例 spatialJoin

    废话不多说,code是王道。

    其中str1、str2两个参数是target路径、join路径 


     private void spatialJoin(Geoprocessor gp, string str1, string str2)

            {
                ESRI.ArcGIS.AnalysisTools.SpatialJoin sj = new ESRI.ArcGIS.AnalysisTools.SpatialJoin();


                saveName("spatialJoin", getFileName(str1) + "_SpatialJoin.shp");


                sj.target_features = str1;


                sj.join_features = str2;


                sj.out_feature_class = getPathName(str1) + "_SpatialJoin.shp";


                sj.join_operation = "JOIN_ONE_TO_ONE";


                sj.match_option = "INTERSECTS";


                sj.join_type = "KEEP_ALL";


                if (sj.join_features != null || sj.target_features != null)
                {
                    IGeoProcessorResult results = null;


                    results = (IGeoProcessorResult)gp.Execute(sj, null);


                    IGPUtilities pGPUtil = new GPUtilitiesClass();


                    IFeatureClass pFC;


                    IQueryFilter pQF;


                    pGPUtil.DecodeFeatureLayer(results.GetOutput(0), out pFC, out pQF);


                    int count = pFC.FeatureCount(null);      //统计Feature对象个数


                    IFeatureCursor pCursor = pFC.Insert(true);   //提取FeatureCursor对象


                    IFeatureLayer pFeatureLayer = new FeatureLayerClass();


                    pFeatureLayer.FeatureClass = pFC;


                    axMapControl1.Map.AddLayer(pFeatureLayer); 


                    result5.Text = "Spatial Join 完成!";


                }
                else
                    MessageBox.Show("请选择图层");
            }

  • 相关阅读:
    VS2012 窗口布局, update1 和 英语语言包 离线安装方法
    C/C++ 笔记
    MFC学习笔记
    理解虚基类、虚函数与纯虚函数的概念
    ffmpeg使用
    gif制作 & word2007插入gif
    WIN8电脑开机怎么进入安全模式啊?
    vs2012 win8 64 visual assistX 中文 ??
    21 获取文件大小的方法
    20 线程中添加超时的方法
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3220232.html
Copyright © 2011-2022 走看看