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("请选择图层");
            }

  • 相关阅读:
    django-rest-framework 注意事项
    Python virtualenv 使用总结篇
    python flask 基础入门
    python property
    python Numpy
    c语言学习的第四天2
    c语言学习第四天数据类型1
    学习c编程的第三天
    学习c编程的第二天
    HTTP首部及各状态码
  • 原文地址:https://www.cnblogs.com/dyllove98/p/3220232.html
Copyright © 2011-2022 走看看