Select to view content in your preferred language

Error when executing a geoprocessor

3315
4
10-10-2011 03:20 AM
HENRYCyril
Emerging Contributor
Hi,

I have created a gpk package with ArcMap. This package content the Viewshed tool with the its parameters (elevation raster and observers feature). When I generated it, I have checked
support ArcGIS Runtime (I have verify that).
When I'm executing this geoprocessor in ArcGIS Runtime, I get this error: "Unable to complete operation".
Some idea about this probem?

Thanks,

Cyril
0 Kudos
4 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Unfortunately from that error message alone, it's difficult to tell what the problem might be. Perhaps you can share your Viewshed tool and the code you have written to execute the tool?

Cheers

Mike
0 Kudos
HENRYCyril
Emerging Contributor
Yes, this error is not really expressive...
My problem is the same as described in this post on Java forum: http://forums.arcgis.com/threads/37297-Viewshed-GP-Tool.
I read that Runtime for Java don't support raster data as a tool input.
Is there this limitation in Runtime for Wpf ?
I can't use the viewshed tool available on arcgis online, I don't have access to internet from my workstation.

Thanks.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Currently neither the WPF or Java Runtime SDKs support raster data as a user (developer) input to a geoprocessing tool. Raster is supported as intermediate data, which is almost certainly what it should be in the case of the viewshed tool you're trying to create/run.

Your inputs to a viewshed model are typically an observer location (a GPFeatureRecordSetLayer containing a point geometry) and a radius (probably a GPLinearUnit).

You need to make sure that you have built your geoprocessing model exactly as you would do for publishing to ArcGIS Server... here are some tips:

#1. Use the %ScratchWorkspace% environment variable for any intermediate/output data (this means ArcGIS Desktop, ArcGIS Runtime and any other ArcGIS applications know where to write the intermediate/output data, instead of just C:\data for example).

#2. Ensure you have set the input(s) AND output as Model Parameters (right click and choose "Model Parameter"). NOTE: Be careful about the order in which you do this as it determines the order in which the parameters are expected when the tool is run. You can open the model properties dialog to confirm (and adjust) the order of the parameters. The output/derived parameter should really always be last.

#3. Run the Geoprocessing tool once within ArcMap to get a successful execution and results.

#4. Share the Geoprocessing result from the Results Window as a Geoprocessing Package. NOTE: Ensure you check the option to support the ArcGIS Runtime.

#5. When programmatically running the GP tool, the order in which you provide the input parameters MUST be exactly the same as the order in which they were defined in the model. The parameter names must also match. you do not need to specify the output parameter.

#6. Insert a breakpoint after the local geoprocessing service is started. Once the breakpoint is hit - check the Error property to confirm there was no problem encountered starting the service. Then get the UrlGeoprocessingService property and paste it into a browser (while the app is still in debug mode and the local server is still running). This will display the HTML view of the server which will tell you what tool(s) are in your GP package and what parameters each tool expects.

Here's the JSON from the Viewshed service mentioned in the Java post which is running on SampleServer1:

{
  "name" : "Viewshed",
  "displayName" : "Viewshed",
  "category" : "",
  "helpUrl" : "http://sampleserver1b.arcgisonline.com/arcgisoutput/Elevation_ESRI_Elevation_World/Viewshed.htm",
  "executionType" : "esriExecutionTypeSynchronous",
  "parameters" : [
    {
      "name" : "Input_Observation_Point",
      "dataType" : "GPFeatureRecordSetLayer",
      "displayName" : "Input Observation Point",
      "direction" : "esriGPParameterDirectionInput",
      "defaultValue" : {
        "DEPRECATED" : {
          "Fields" : "The 'Fields' property has been deprecated. Please use the 'fields' property instead."
        },
        "geometryType" : "esriGeometryPoint",
        "spatialReference" : {
          "wkid" : 54003
        },
        "Fields" : [
          {
            "name" : "FID",
            "type" : "esriFieldTypeOID",
            "alias" : "FID"},
          {
            "name" : "Shape",
            "type" : "esriFieldTypeGeometry",
            "alias" : "Shape"},
          {
            "name" : "OffsetA",
            "type" : "esriFieldTypeDouble",
            "alias" : "OffsetA"}
        ],
        "fields" : [
          {
            "name" : "FID",
            "type" : "esriFieldTypeOID",
            "alias" : "FID"},
          {
            "name" : "Shape",
            "type" : "esriFieldTypeGeometry",
            "alias" : "Shape"},
          {
            "name" : "OffsetA",
            "type" : "esriFieldTypeDouble",
            "alias" : "OffsetA"}
        ]
      },
      "parameterType" : "esriGPParameterTypeRequired",
      "category" : "",
      "choiceList" : []
    },
    {
      "name" : "Viewshed_Distance",
      "dataType" : "GPLinearUnit",
      "displayName" : "Viewshed Distance",
      "direction" : "esriGPParameterDirectionInput",
      "defaultValue" : {
        "distance" : 15000,
        "units" : "esriMeters"
      },
      "parameterType" : "esriGPParameterTypeRequired",
      "category" : "",
      "choiceList" : []
    },
    {
      "name" : "Viewshed_Result",
      "dataType" : "GPFeatureRecordSetLayer",
      "displayName" : "Viewshed Result",
      "direction" : "esriGPParameterDirectionOutput",
      "defaultValue" : {
      },
      "parameterType" : "esriGPParameterTypeRequired",
      "category" : "",
      "choiceList" : []
    }
  ]
}

Hopefully this should help you progress with running the viewshed.


Cheers

Mike
0 Kudos
HENRYCyril
Emerging Contributor
Mike, thanks for this tips.
I'll try it and give feedback later.
0 Kudos