ArcGIS Pro二次开发执行GP工具

Posted gisoracle

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ArcGIS Pro二次开发执行GP工具相关的知识,希望对你有一定的参考价值。

using System;
using System.Collections.Generic;
using System.Linq;
//using System.Windows;
//using System.Windows.Forms;




using System.Text;

using System.Threading;

using System.Threading.Tasks;

using ArcGIS.Desktop.Core.Geoprocessing;

using ArcGIS.Desktop.Framework;

using ArcGIS.Desktop.Framework.Contracts;

using ArcGIS.Desktop.Framework.Dialogs;

using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Core;

using ArcGIS.Desktop.Framework.Threading.Tasks;



namespace ProAppModule1
{
    internal class Button1 : ArcGIS.Desktop.Framework.Contracts.Button
    {
        string output = "gisoracle";
        protected override void OnClick()

        {

            FeatureLayer layer = MapView.Active.Map.Layers[0] as FeatureLayer;
            string path = Project.Current.DefaultGeodatabasePath+"/";

            Select(layer, path + output);
        }


        public bool Select(FeatureLayer layer, string output)
        {


            try
            {
                var result = QueuedTask.Run(() =>

               {

                   var args = Geoprocessing.MakeValueArray(layer, output);

                   return Geoprocessing.ExecuteToolAsync("analysis.Select", args);



               });
                return true;

            }
            catch (Exception ex)
            {
                MessageBox.Show("错误:" + ex.Message.ToString());


                return false;
            }
                                 

        }
    }
}

 

以上是关于ArcGIS Pro二次开发执行GP工具的主要内容,如果未能解决你的问题,请参考以下文章

ArcGIS Pro快速汉化方法-汉化GP

ArcGIS Pro二次开发(19):创建要素类(FeatureClass)

ArcGIS Pro二次开发,定制开发,参考资料

ArcGIS Pro二次开发-添加字段

ArcGIS Pro二次开发画注记

ArcEngine——异步执行GP工具(Background geoprocessing)