Hi,
I'm trying to use ExecuteToolAsync () to run the tool TopoToRaster but I could not figure it out.
Not sure what the parameters are required to run it.can someone help out please?
I attached a sample Button OnClick method that includes all parameters and environment settings to call the 'Topo to Raster' GP Tool. To figure out in what form to pass in the parameter values I usually use the following approach:
- I run the GP Tool manually and define all needed parameters
- After the GP Tool completes, I click the "Open History" link to open the Geoprocessing History tab
- I right click on the GP Tool and select the "Copy Python Command" from the context menu.
- I then paste the 'Python Command' syntax into a text editor to see the parameter value formats.
- I use the python command's parameter format to fill in the parameters for the ExecuteToolAsync call
up
Thank you for the reply. by any chance you know what should be passed as the input feature. The documentation said it needs to specify the elevation field. In my case it will be the TopoPointElevation but Im not sure how to create that in C#.below is the explanation of the input feature :
Each feature input can have a field specified that contains the z-values and one of six types specified.
https://pro.arcgis.com/en/pro-app/3.3/tool-reference/spatial-analyst/topo-to-raster.htm
Hi @sz66666 ,Can you try like this:
// Create the parameter array for the TopoToRaster tool var parameters = Geoprocessing.MakeValueArray( inTopoFeatures, cellSize, extent, margin, minimumZValue, maximumZValue, enforce, dataType, maximumIterations, roughnessPenalty, discreteErrorFactor, verticalStandardError, tolerance1, tolerance2, outStreamFeatures, outSinkFeatures, outDiagnosticFile, outParameterFile, profilePenalty, outResidualFeature, outStreamCliffErrorFeature, outContourErrorFeature ); // Set execute flags GPExecuteToolFlags executeFlags = GPExecuteToolFlags.AddOutputsToMap | GPExecuteToolFlags.GPThread | GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.RefreshProjectItems; // Execute the TopoToRaster tool IGPResult gpResult = await Geoprocessing.ExecuteToolAsync("SpatialAnalyst.TopoToRaster", parameters, null, null, null, executeFlags); // Show the messages Geoprocessing.ShowMessageBox(gpResult.Messages, "TopoToRaster Messages", gpResult.IsFailed ? GPMessageBoxStyle.Error : GPMessageBoxStyle.Default);
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.