Geoprocessing Widget - Don't See Outputs

2154
14
02-06-2018 06:25 AM
ChrisHolmes
Occasional Contributor III

Hello everyone,

I have a script in arcmap which operates on selected blocks on the map and does some calculations and then displays results like this:

I had the script (python toolbox) published as a gp service so I could use it from the geoprocessing wizard. It seems to "validate" ok when I enter the url to the service. It shows absolutely nothing for inputs/outputs/options. I'm using the select widget to select the blocks on the land use layer then clicking the geoprocessing widget then execute.

This is what happens in web appbuilder:

I really have no idea what's going on with it in web appbuilder. I know that in arcmap the script knows to look at the land use layer for selected blocks and then it does its calculations. Not quite sure at the moment how to move forward with getting this working. Any help appreciated.

Thanks

0 Kudos
14 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Chris,

I'm not sure a GP service is able to pick up a selection from the Select widget.  I would try changing the script to use an expression (i.e. USE_CATEGORY = 'Park') rather than a selection to see if it works.

Also, right-click on the GP service > service properties > Parameters.  Set the Message Level to Info.  This should provide more information when the tool fails.

ChrisHolmes
Occasional Contributor III

Hi Jake, thanks for the feedback. I will check the message level and set it to Info. And with the service, I was 'hoping' that since the script in arcmap is told which layer to look at for selected blocks, that that would carry over to the execution of the gp service.

0 Kudos
ChrisHolmes
Occasional Contributor III

Here is the error message provided when message level = info:

  • Running script DiversityIndex...
  • Traceback (most recent call last): File "\\coc\apps\gis\gistools\gp\2.7\dev\int_planning\diversityindex\modules\DiversityIndex_Mod.py", line 82, in execute mxd = arcpy.mapping.MapDocument('CURRENT') File "c:\program files\arcgis\server\arcpy\arcpy\arcobjects\mixins.py", line 612, in __init__ super(MapDocumentMethods, self).__init__(mxd) File "c:\program files\arcgis\server\arcpy\arcpy\arcobjects\_base.py", line 47, in __init__ for arg in args)) RuntimeError: Object: CreateObject cannot open map document
  • Failed to execute (DiversityIndex).
0 Kudos
JakeSkinner
Esri Esteemed Contributor

You won't be able to use the "CURRENT" keyword in your script since the GP service is not accessing an MXD.  You can hard code the path to the MXD but I don't think this will resolve the selection issue.  You would most likely need to do a custom widget for the functionality you want.  You can read the web app selection using the JavaScript API and possibly pass this as a parameter to a GP service.  However, this would require using Web AppBuilder Developer Edition so you could create the custom widget.

If possible I would have the user enter in a query via a GP parameter to get the selection they need.

ChrisHolmes
Occasional Contributor III

Yes, I just a few minutes figured out the bit about the ‘CURRENT’.

I did see recently when looking at the documentation for the Select widget that you could specify the results of the selection to be used as input to a gp widget (I think). But I do not see that available in the web appbuilder I see when I log into our agol.

Thanks Jake

0 Kudos
JakeSkinner
Esri Esteemed Contributor

You're right, it appears you can:

Select widget—Web AppBuilder for ArcGIS | ArcGIS 

The selected features can be passed on to other widgets as input, such as the Geoprocessing widget

Looks like there is an option to set the selection as the input for GP services:

ChrisHolmes
Occasional Contributor III

I think the reason that I don't see "Set as Input of Geoprocessing" as an available option for me is because my script has no inputs. In the script I am just using a searchcursor on the landuse layer to work with selected records. But I'm starting to think that in the web appbuilder world it's not that simple.

0 Kudos
ChrisHolmes
Occasional Contributor III

And a little further reading and I'm starting to think that I need to rework my script so that it has inputs and outputs.

0 Kudos
KevinBell1
New Contributor III

I'm not getting these options.  Any more progress on this?

0 Kudos