Select to view content in your preferred language

Watershed delineating using local server and arcgis runtime sdk for .net?

1738
6
06-18-2020 08:58 PM
ManishShrivastav
Occasional Contributor

Hi,

I am trying to build a WPF Desktop app, wherein I am using Local server to consume a geoprocessing package. The idea is to develop an app where I can click at a location, to mark an outlet point, on the map and click the generate button to generate the watershed above the outlet. I tried to follow the sample from https://developers.arcgis.com/net/latest/wpf/sample-code/local-server-geoprocessing/

But not successful in achieving the goal and I get “Job failed” message box.

I am attaching the code also. Any help is much appreciated.

0 Kudos
6 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

This is a really exciting use case for Local Server. 

Question: Before I take a look... are you able to use ArcGIS Pro instead of ArcMap? (the next release of Local Server approx Q3 2020 will only support Pro packages, therefore I'd prefer to get you going in that direction if possible)

Thanks

Mike

0 Kudos
ManishShrivastav
Occasional Contributor

Hi Mike,

One of the reasons that I use ArcMap instead of ArcGIS pro is because many parts of the application were previously built using ArcMap. I will not have a problem transitioning to ArcGIS Pro for building new applications. As far as old ones, I can still use ArcGIS Pro if there is an easy way to upgrade the old ones rather than writing whole new program.

Thanks,

Manish

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

One issue might be that you're not providing any input features.

Your code initializes the features:

`gpParams.Inputs["Outlet of Watershed"] = new GeoprocessingFeatures();`

But I can't see any code that adds a feature to that input. You'll need something like this:

arcgis-runtime-samples-dotnet/AnalyzeViewshed.xaml.cs at master · Esri/arcgis-runtime-samples-dotnet... 

I also recommend reading this topic for tips on publishing geoprocessing services: A quick tour of authoring and sharing geoprocessing services—Documentation | Documentation for ArcGI... 

Thanks

Mike

0 Kudos
ManishShrivastav
Occasional Contributor

Hi Mike,

Thanks for pointing out to resourceful documentations. I tried to make some adjustments in the code as pointed out in the link https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/master/src/WPF/ArcGISRuntime.WPF.Viewer/S....

After running the code, "Job Failed" message box shows up with message as follows:

I am attaching the new code as well.. Please let me know the work around.

Thanks,

Manish

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Looking at the error message, it indicates that there was a problem reading the raster dataset that is the input to the Snap Pour Point (Spatial Analyst) tool - specifically it failed to find or read the VAT (raster attribute table). 

In your Model, that's the output from the Flow Accumulation tool therefore I recommend looking at the properties of that tool. For example, where is the output being written? I always advise using the environment variables %ScratchFolder% or  %ScratchGDB% for the ScratchWorkspace e.g. %ScratchFolder%\FlowAccOutput.tif.

For more info see:

Scratch Folder (Environment setting)—Help | Documentation

Scratch GDB (Environment setting)—Help | Documentation.

Then in your Model properties window set the location of the Scratch Workspace environment to a folder you know exists e.g. C:\WatershedDelineation\Scratch in which you have created a file geodatabase `scratch.gdb`.

These variables are substituted at runtime by ArcGIS whether running in the context of ArcMap or ArcGIS Runtime Local Server.

Thanks

Mike

0 Kudos
ManishShrivastav
Occasional Contributor

Hi Mike,

I have tried to follow the instructions and rewritten the tool making sure that everything is output to "ScratchGDB" but I am still not able to get Raster Attribute Table from the output of Flow Accumulation. I have also tried to create the attribute table using "Build Raster Attribute Table" tool, which runs without any error but fails to create the attribute table.

With all this I am still getting the same Geoprocessing Error as earlier.

Thanks

Manish

0 Kudos