Geoprocessing tool result object returned by
Geoprocessing.ExecuteToolAsync
Multi Ring Buffer
//The data referenced in this snippet can be downloaded from the arcgis-pro-sdk-community-samples repo
//https://github.com/Esri/arcgis-pro-sdk-community-samples
async Task<IGPResult> CreateRings(EditingTemplate currentTemplate)
{
var paramsArray = Geoprocessing.MakeValueArray(currentTemplate.MapMember.Name,
@"C:\Data\FeatureTest\FeatureTest.gdb\Points_MultipleRingBuffer",
new List<string> { "1000", "2000" }, "Meters", "Distance",
"ALL", "FULL");
IGPResult ringsResult = await Geoprocessing.ExecuteToolAsync("Analysis.MultipleRingBuffer", paramsArray);
var messages = string.IsNullOrEmpty(gpResult.ReturnValue)
? $@"Error in gp tool: {gpResult.ErrorMessages}"
: $@"Ok: {gpResult.ReturnValue}";
return ringsResult;
}
Non-blocking execution of a Geoprocessing tool
//The data referenced in this snippet can be downloaded from the arcgis-pro-sdk-community-samples repo
//https://github.com/Esri/arcgis-pro-sdk-community-samples
string in_data = @"C:\tools\data.gdb\cities";
string cities_buff = @"E:\data\data.gdb\cities_2km";
var valueArray = Geoprocessing.MakeValueArray(in_data, cities_buff, "2000 Meters");
// to let the GP tool run asynchronously without blocking the main thread
// use the GPThread option of GPExecuteToolFlasgs
//
GPExecuteToolFlags flags = GPExecuteToolFlags.GPThread; // instruct the tool run non-blocking GPThread
IGPResult bufferResult = await Geoprocessing.ExecuteToolAsync("Analysis.Buffer", valueArray, null, null, null, flags);
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.