Geoprocessing Service Results in Web App

8410
14
09-14-2015 05:33 PM
BryanDieter
New Contributor III

I have published a geoprocessing service to ArcGIS Server, and have added it to a web application (ArcGIS Online Web App Builder geoprocessing widget).  I am able to execute the tool from within the application, and the resulting feature class is added to the map.  However, there are a few problems with the output:

1.  I am not able to get pop-up information for the geoprocessing result

2.  it does not show up in the application's legend widget

3.  when configuring the geoprocessing widget, I do not see any options for defining the symbology and popup fields for the output as described in the widget documentation

Does anybody have any ideas for fixing this?  Perhaps the output parameter is not configured correctly in my original tool/python script? 

Please let me know if you have any suggestions.

Thanks

14 Replies
XanderBakker
Esri Esteemed Contributor

Can you tell us a little more about how the output is defined? Is it a featureclass or a featureset. Does the GP service have a related MapService? All these things influence the way the result can be managed in the WebApp created with the WAB.

0 Kudos
BryanDieter
New Contributor III

Actually, I've made a small amount of progress since posting my question.  When configuring the geoprocessing widget in WAB, under Options there is a check box for 'Use the drawing options of result map service'.  If I uncheck this, then the Renderer and Popup options do display for the Output.  However, under Renderer, it says 'Can not set renderer because of unknown geometry type.'  And under Popup, the list of fields is empty. 

The script tool that I am trying to publish is fairly basic, in which I am querying a table, calculating some statistics on the query result, and then joining the stats table to a feature class.  At the end of the script I have the line:

arcpy.SetParameter(1, "output_fc")

I checked to see if I overlooked some of the configuration options in the Service Editor when publishing the GP service, and the geometry and schema are blank there also. 

0 Kudos
BryanDieter
New Contributor III

In the properties for the script tool, the output parameter data type is Feature Class; the type is Derived; and the direction is Output.

0 Kudos
JianWang3
New Contributor III

I think the reason is that there is no geometry type in your service definition for the output parameter. So the widget doesn't know how to configure the symbol. And the result will be added as GraphicsLayer.

You should adjust your geoprocessing service to add a geometry type to your output.

0 Kudos
BryanDieter
New Contributor III

Thank you for the help Jian and Xander. 

I made some changes to the input datasets for the script tool, and am now seeing the geometry (Polygon) and schema (list of fields) info in the Service Editor when publishing the GP service. However, in web app builder, when adding the service to the geoprocessing widget,  I am still seeing the message 'Can not set renderer because of unknown geometry type' and no fields are visible in the popup configuration.

Jian, is there a way to confirm that the service definition includes a geometry type for the output parameter? 

Thanks again,

Bryan

0 Kudos
BryanDieter
New Contributor III

I seem to be having the same problem as described in this post:

Re: Cannot renderer gp service results

I ended up using the same work around of embedding the script tool in a model, which fixes my problem.

ModyBuchbinder
Esri Regular Contributor

Hi

That was my solution and it is working for me.

Back to one of the original questions of this post, Is there any way to see in WAB a arcpy.AddMessage command in python?

You can see it when you run the service in REST or see it in server logs but I could not find a way to see it in WAB.

Sometime the output of GP service is just error message.

Mody

0 Kudos
GrantHerbert
Occasional Contributor II

To see the output message from a GP service in a WAB widget, try the following:

        arcpy.AddMessage(msg)

        resultMsg = msg

then at the end of your script (assuming you are wrapping it in a try):

    finally:

        arcpy.SetParameterAsText(1, resultMsg)

The resultMsg should now appear in the Output side of the GP tool in the WAB.

FabioD_Ovidio
New Contributor II

Hello,

I'd like to use output result feature (es. points) of a geoprocessing widget as input for another geoprocessing widget that is configured as list of avaible layers on the map. How can I do? Is it necessary to refresh the widget?

0 Kudos