码迷,mamicode.com
首页 > 其他好文 > 详细

ArcGIS Pro二次开发执行GP工具

时间:2020-03-12 12:55:51      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:sel   res   log   sep   ted   RoCE   layer   als   ons   

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工具

标签:sel   res   log   sep   ted   RoCE   layer   als   ons   

原文地址:https://www.cnblogs.com/gisoracle/p/12468397.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!