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
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.
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.
Here is the error message provided when message level = info:
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.
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
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:
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.
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.
I'm not getting these options. Any more progress on this?