Geoprocessing Service Results in Web App

8501
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
GrantHerbert
Occasional Contributor II

Are you loading the results as a layer or as graphics?

If a layer, you should be able to refresh the layer list in the second widget. I am new to widgets in general, but I would look into some of the events available in the widget code and see if one is suitable, worst case you could have a button that reloaded the layers.

If graphics then you will have to extract them from the map, and check that the format is suitable for input to your process.

Alternatively, could you chain the processes together?

0 Kudos
ScottEvans6
New Contributor III

Hey Grant,

I have a bunch of AddMessage statements that look like somewhat of a small report after the tool is done running. How do i implement the "arcpy.SetParameterAsText(1, resultMsg)" that you mentioned in your earlier reply. I want to display text resultsin the GP widget output window.

Thanks!

AhnaMiller2
Occasional Contributor

Grant, the solution you propose to adding a message in the Geoprocessing tool of WAB, will this work in the out of the box version of WAB or does it need to be a custom widget in web app developer?

XanderBakker
Esri Esteemed Contributor

Short answer, it will work with the out of the box version of WAB (for instance the one available in WAB).

When you create a processing service based on a script that you configured as a tool, you have the possibility to define the input and output parameters. When you use an output parameter, you can set the value of this parameter in the script. For instance, the part that states "arcpy.SetParameterAsText(1, resultMsg)" will set the text contained by the variable resultMsg to the parameter with index 1 (the second parameter). When you publish the script and consume the GP Service in the WAB Geoprocessing widget, you will notice two parameters, 1 input and 1 output in this case. The input will be asked and the output will be shown after the process successfully completes. 

ScottEvans6
New Contributor III

After some tinkering around, I found and alternative solution. I realized that WAB does not recognize the "\n" new line symbol in python. So for larger reports, your output may be all jumbled up. What I did was write the info to a text file. That text file shows up in the results window as a link that can be clicked by the user. It then opens up in a new browser tab.