• ArcGIS Pro删除一个字段


     private async Task<bool> ExecuteDeleteFieldTool(BasicFeatureLayer theLayer, string fieldName)
            {
                try
                {
                    return await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
                    {
                        var inTable = theLayer.Name;
                        var table = theLayer.GetTable();
                        var dataStore = table.GetDatastore();
                        var workspaceNameDef = dataStore.GetConnectionString();
                        var workspaceName = workspaceNameDef.Split('=')[1];
    
                        var fullSpec = System.IO.Path.Combine(workspaceName, inTable);
                        System.Diagnostics.Debug.WriteLine($@"Delete {fieldName} from {fullSpec}");
    
                        var parameters = Geoprocessing.MakeValueArray(fullSpec, fieldName);
                        var cts = new CancellationTokenSource();
                        var results = Geoprocessing.ExecuteToolAsync("management.DeleteField", parameters, null, cts.Token,
                            (eventName, o) =>
                            {
                                System.Diagnostics.Debug.WriteLine($@"GP event: {eventName}");
                                if (eventName == "OnMessage")
                                {
    
                                    System.Diagnostics.Debug.WriteLine($@"Msg: {o}");
                                }
                            });
                        return true;
    
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    return false;
                }
            }
  • 相关阅读:
    编译内核开始的小问题Unable to find the Ncurses libraries
    qq for linux Ubuntu 64位兼容
    ubuntu下安装lighttpd
    搭建boa服务器
    INI file and Iniparser
    kernel常用.gitignore配置
    光谱学习
    jump to case label fpermissive
    Qt通用方法及类库5
    Qt通用方法及类库1
  • 原文地址:https://www.cnblogs.com/gisoracle/p/16043555.html
Copyright © 2020-2023  润新知