When will Net developers get API reference for all geoprocessing functions?

1870
9
12-11-2019 02:47 AM
GKmieliauskas
Esri Regular Contributor

Dear colleagues from Esri,

Most calculation or database management functions in ArcGIS Pro SDK are realized using geoprocessing. All information you can get about geoprocessing functions:

- ArcGIS Pro API reference (about Geoprocessing.ExecuteToolAsync and etc.)

- ArcGIS Pro Snippets ( about "management.CopyFeatures""Analysis.MultipleRingBuffer" and "Analysis.Buffer")

- other ArcGIS documentation with ArcPy samples.

What to do for ArcGIS Pro SDK .Net  developer? Run geoprocessing tool from ArcGIS Pro, copy from history arcpy code of executed tool, solve rebus how to convert geoprocessing tool name from arcpy to .Net, how to arrange parameters especially list and etc.?

For example spatial analyst Euclidean distance tool. Arcpy script from history looks like this:

out_distance_raster = arcpy.sa.EucDistance(r"Sites", 1000, 50, None, "PLANAR", None, None);
out_distance_raster.save(r"C:\CellExp\Tutorial\ProTest\Pro\MyProject5.gdb\EucDist_Site1")

First idea is to check geoprocessing results. It is wrong way. You need somehow to understand that result raster name must be second parameter after featureclass name. Looks strange but it works. 

In snippet mentioned above ("Analysis.Buffer") you can find geoprocessing flag GPExecuteToolFlags.GPThread. Try to use that flag with Euclidean distance. You will wait for results of Euclidean distance all your life and you will never get results. I had a problem few ArcGIS Pro releases ago and solving of problem was GPExecuteToolFlags.GPThread flag adding. When that flag is useable when not?

Could you please make a table with all available geoprocessing functions for .Net developers with arguments or make some notes where are differences between arcpy and .Net calling, explain more complicated arguments converting from arcpy to .Net and put it on ArcGIS Pro API reference, ArcGIS Pro SDK GitHub or somewhere else.

One more line about ArcGIS Pro API reference on internet. Open it with MS Explorer, Edge and press "Search" button at the bottom of left corner. Search input line appears after 0,5-1 minute. In our country we have one of the fastest internet network and it is not a internet speed problem. Other internet browsers I have not tried.

9 Replies
NobbirAhmed
Esri Regular Contributor

Hi Gintautas, thanks for your suggestions. We're also requesting suggestions from all users. We'll add more examples, snippets as soon as possible. Meanwhile, if you have any other comments please share. Thanks again. 

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi Nobir, 

I am back to my suggestion. 

My application needs HillShade geoprocessing tool. Situation the same as with EucDistance tool.

out_raster = arcpy.sa.HillShade("dsm", 315, 45, "SHADOWS", 1); 

Output raster parameter in second place for .Net API. How to find it? I have spent half a day. Empty error  messages. After some time I found old good ArcGIS 9.3 page:

http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Hillshade

and one line in the scope of page:

# Process: Hillshade gp.Hillshade_sa(InRaster, OutRaster, InAzimuth, InAltitude)

Another one note. When I execute from .Net Add-in geoprocessing tool with GPExecuteToolFlags.AddToHistory flag, if tool finishes successfully it adds it to history, otherwise -no. When you execute tool from ArcGIS Pro Geoprocessing pane it adds to history always. It would be useful to have the same functionality and from ArcGIS Pro API.

0 Kudos
by Anonymous User
Not applicable

Hi Gintautas,

That's what I am looking for in my previous question that you are trying to answer.

https://community.esri.com/thread/244499-create-rasterdataset 

NobbirAhmed
Esri Regular Contributor

Hi Gintautas, we are in the process of adding Pro SDK C# snippets/examples along with Python examples. So, when you'll open a tool reference/help page you'll see one or more C# code examples.

However, it may take some time - don't know the final schedule yet. 

Thanks again to the GeoNet community

0 Kudos
ThomasCox
Occasional Contributor

Can't happen soon enough

0 Kudos
LesleyBross1
New Contributor III

+1 for a reference page that at least provides the name of each GP tool that can be executed using the C# Geoprocessing object. I spent most of my afternoon yesterday after upgrading from Pro 2.4 to 2.6.3. The ZonalStatisticsAsTable tool was apparently renamed to ZonalStatisticsAsTable_sa in this new version which broke my existing code. I found no documentation anywhere of this change. And this is not the first time I have had to hunt down the name of a tool.

And +1 that the search function in the ArcGIS Pro SDK function is quite slow. Using Chrome on Windows 10.

DouglasLong
Occasional Contributor

this is hilarious but it is true.

The Pro SDK Search here is slower than a Lada full of elephants going uphill!

Also, it is not good that we have to reference ArcGIS 9.3 tool guide to get proper parameters for outputs running ArcGIS Pro SDK.

0 Kudos
NobbirAhmed
Esri Regular Contributor

Not 9.3 - but the current version of the software. For example, ArcGIS Pro 2.5. If you look into an older version then you won't see documentation for the newer tools.

0 Kudos
DouglasLong
Occasional Contributor

disagree with you, Gintautas Kmieliauskas‌ is right. for example, take a look at the quick cut fill in PRO SDK

For example - the code below is done according to the documentation, however, there is no way you can specify the output raster in the code using the PRO SDK.

// according to arcgis PRO SDK
var cutFillParams = Geoprocessing.MakeValueArray(raster1, raster2, z_factor);
var gpresult = await Geoprocessing.ExecuteToolAsync("CutFill_sa", cutFillParams, environments);‍‍‍‍

Luckily the 9.3 Cut FIll tells you how to specify the output raster

which for Arc PRO SDK capability to set raster, you can put the outRaster before the z_factor, hence it is different than PRO SDK documentation.

// according to arcgis PRO SDK
var cutFillParams = Geoprocessing.MakeValueArray(raster1, raster2, outRaster, z_factor);
var gpresult = await Geoprocessing.ExecuteToolAsync("CutFill_sa", cutFillParams, environments);‍‍‍‍‍‍‍