Passing Geoprocessing Parameters to LocalServer (WPF v100.3)

1778
12
10-03-2018 03:16 PM
KeithGemeinhart1
New Contributor III

I have a gpkx that I created in Pro 2.2, and I'm trying to call it from an application using LocalServer. Everything starts up OK, but I'm not sure how to format the input parameter. In this case, it should be a list of DTED filenames. Here is the parameter as described on the REST interface webpage. 

I guess I have 2 questions:

1. How would I format the input to test on this REST interface webpage?

2. How do I format the input parameters in code?

For both, assume the DTED files are somewhere like C:/..../DTED/N30.dt1, etc.

0 Kudos
12 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

You should be able to use the types GeoprocessingMultiValue<> in conjunction with GeoprocessingDataFile:

GeoprocessingMultiValue(T) Class 

GeoprocessingDataFile Class 

Data file will be something like... `{ "url" : "c:\data\..." }` making multi value something like:

```

[
{ "url" : "c:\data\..." },
{ "url" : "c:\data\..." }
]

```

For more info see Submit GP Job—ArcGIS REST API: Services Directory | ArcGIS for Developers 

Cheers

Mike

0 Kudos
KeithGemeinhart1
New Contributor III

Thanks! That got me moving in the right direction. But now I have a new problem. When I run from either code or via the REST interface, I get ERROR 000816: The tool is not valid. This happens both in code and REST interface

After researching that error code, common wisdom points to a permission issue and possibly enabling the geoprocessing feature in the runtime config file. So I changed all of the config parameters to true, but that resulted in the following error:

I was able to narrow it down to this attribute. When false, I get the 000816 error. When it's true, I get the one shown above.

               <Package id="ProMosaicRasters" name="Mosaic Rasters" enabled="true" />

My desktop & pro are licensed via the C/JMTK license which is the desktop standard license. But I'm also running this inside of Visual Studio, so I'm assuming that the Dev/SDK would allow this to run. And I can run the model successfully in both ArcMap and Pro. If I'm reading this page correctly, Local Server geoprocessing tools support—ArcGIS Runtime SDK for .NET (WPF) | ArcGIS for Developers , the standard desktop license should work.

Here is a snapshot of my model.

Any advice you can give would be appreciated!! Maybe there is a better way to compute slope? The end goal of this model is to provide a result (features) where slope is >5%.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

It's failing to create the local service which often indicates something is missing from the deployment. To determine if it's just a deployment configuration issue - open the deployment file (`ArcGISLocalServer_100.3.AGSDeployment`) and set the entire Pro package to false (example below). This will ensure the Local Server runs from the SDK installation (typically `C:\Program Files (x86)\ArcGIS SDKs\LocalServer100.3`).

` <Package id="Pro" name="ArcGIS Pro Compatible Server" enabled="false">`

Regarding the model, generally you should avoid reprojecting data unless it's really necessary. 

Cheers

Mike

0 Kudos
KeithGemeinhart1
New Contributor III

If I change the line you mention to false, I get the following:

If I also change the corresponding line for ArcMap compatibility to false, I get the same "failed to create service ..." exception shown in previous reply.

0 Kudos
KeithGemeinhart1
New Contributor III

Some additional info. I created another gpkx with a single operation (Create File Geodatabase) with no model parameters, and it ran successfully. So I'm guessing one of the tools inside my slope model is causing the problem. Can we determine if this is a licensing issue or a problem with one of the tools? Any suggestions on how to debug this?

0 Kudos
KeithGemeinhart1
New Contributor III

More info ... I decided to simply the model to determine which tool(s) are causing an issue. It looks like Raster to Polygon causes the "Failed to create service ... GPServer" exception. There may be others, but this is the first one I've identified. It works when I take it out.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Thanks for narrowing down - I will try to reproduce. Have you tried other raster datasets?

Cheers

Mike

0 Kudos
KeithGemeinhart1
New Contributor III

I have not tried this on any other types of rasters. I only have DTED at the moment. There may be other tools that cause the error as well, but I haven't explicitly tested any others yet.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi Keith,

It just occurred to me, whilst replying to another similar thread - you may need to set the TempPath property to a shorter path (by default it uses your user profile temp).

ArcGISRuntimeEnvironment.TempPath Property 

e.g. to verify if this is the case here try something like "C:\Temp".

We're adding a more detailed discussion of this property in relation to the Local Server to the Guide doc.

Cheers

Mike

0 Kudos