• ArcGIS Pro二次开发-创建图层


    using System;
    
    using System.Collections.Generic;
    
    using System.Linq;
    
    using System.Text;
    
    using System.Threading.Tasks;
    
    using ArcGIS.Core.CIM;
    
    using ArcGIS.Core.Data;
    
    using ArcGIS.Core.Geometry;
    
    using ArcGIS.Desktop.Catalog;
    
    using ArcGIS.Desktop.Core;
    
    using ArcGIS.Desktop.Editing;
    
    using ArcGIS.Desktop.Extensions;
    
    using ArcGIS.Desktop.Framework;
    
    using ArcGIS.Desktop.Framework.Contracts;
    
    using ArcGIS.Desktop.Framework.Dialogs;
    
    using ArcGIS.Desktop.Framework.Threading.Tasks;
    
    using ArcGIS.Desktop.Mapping;
    
    using ArcGIS.Desktop.Core.Geoprocessing;
    
    namespace ProAppModule1
    {
    
        internal class Button2 : Button
        {
    
            public enum EnumFeatureClassType
    
            {
    
                POINT,
    
                MULTIPOINT,
    
                POLYLINE,
    
                POLYGON
    
            }
            public static async Task CreateFeatureClass(string featureclassName, EnumFeatureClassType featureclassType, SpatialReference pSpatialReference)
    
            {
    
                List<object> arguments = new List<object>
    
          {
    
            // store the results in the default geodatabase
    
            CoreModule.CurrentProject.DefaultGeodatabasePath,
    
            // name of the feature class
    
            featureclassName,
    
            // type of geometry
    
            featureclassType.ToString(),
    
            // no template
    
            "",
    
            // no z values
    
            "DISABLED",
    
            // no m values
    
            "DISABLED"
    
          };
    
                await QueuedTask.Run(() =>
    
                {
    
                    // spatial reference
    
                    // arguments.Add(SpatialReferenceBuilder.CreateSpatialReference(3857));
                    arguments.Add(pSpatialReference);
                   
    
                });
    
                IGPResult result = await Geoprocessing.ExecuteToolAsync("CreateFeatureclass_management", Geoprocessing.MakeValueArray(arguments.ToArray()));
    
            }
    
    
    
            protected override async void OnClick()
            {
                var mv = MapView.Active;
                SpatialReference pSpatialReference= mv.Map.SpatialReference;
                EnumFeatureClassType featureclassType = EnumFeatureClassType.POLYGON;
                string featureclassName = "gisoracle";
                await CreateFeatureClass(featureclassName, featureclassType, pSpatialReference);
                //
            }
    
        }
    
    
    
    }
  • 相关阅读:
    英语:漏屋-英语学习的真实方法及误区分析(转)
    TSP(旅行者问题)——动态规划详解(转)
    用二进制位表示状态,从而将状态压缩到一个整数里表示
    Android的CursorLoader用法小结
    RMQ问题ST算法 (还需要进一步完善)
    离散化
    反转(开关问题) POJ 3276
    关于序列中某个元素位置的查找
    快速幂运算
    Docker学习2-虚拟化
  • 原文地址:https://www.cnblogs.com/gisoracle/p/12465931.html
Copyright © 2020-2023  润新知