ArcGIS Pro更新一个图层数据源路径
private async void ChangeDatasource(FeatureLayer featLayer, string newGDB) { await QueuedTask.Run(() => { // provide a replacement data connection object CIMDataConnection updatedDataConnection = new CIMStandardDataConnection() { WorkspaceConnectionString = $"DATABASE={newGDB}", WorkspaceFactory = WorkspaceFactory.FileGDB, DatasetType = esriDatasetType.esriDTFeatureClass, Dataset = featLayer.Name }; // the updated Data connection should look like this: // CustomWorkspaceFactoryCLSID: null // Dataset: "TestMultiPoints" // DatasetType: esriDTFeatureClass // WorkspaceConnectionString: "DATABASE=C:\\Data\\FeatureTest\\FeatureTest.gdb" // WorkspaceFactory: FileGDB // overwrite the data connection featLayer.SetDataConnection(updatedDataConnection); }); }