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.
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.
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:
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.
In the properties for the script tool, the output parameter data type is Feature Class; the type is Derived; and the direction is Output.
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.
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?
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.
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.
To see the output message from a GP service in a WAB widget, try the following:
resultMsg = msg
then at the end of your script (assuming you are wrapping it in a try):
The resultMsg should now appear in the Output side of the GP tool in the WAB.
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?