I’ve gained a lot of insight about successfully publishing geoprocessing tools in ArcMap for Web App Builder GP widgets.
All of these lessons are lessons that I wish I knew about before spending time searching Google or on GIS Stack Exchange looking up solutions to the errors I encountered.
Here are 3 important lessons I learned about when publishing geoprocessing services:
1. Sending CSV Files to a GP Service is Possible
If your users need the ability to upload CSV (or other small) files to the GP service, do the following:
- Choose GPDataFile for the input parameter data type in your Python toolbox
- Check the uploads option in operations allowed in the Geoprocessing service settings
(ArcGIS 10.1 and above may be required for this functionality.)
2. Tool Validation Won’t Work (for the most part) After Publishing Tool
Sometimes I need to create custom tool validation code for my Python toolboxes to implement functionality that can’t be easily created in a standard Python script. This validation code works fine when my Python toolbox is ran in ArcMap. However, when I publish a tool as a geoprocessing service, the validation code does not work when the GP service is ran from a web map.
My solution to this problem is to implement the custom functionality needed inside a JavaScript file instead for my web maps.
3. All Feature Layer Output Parameters Need to be Created
Sometimes you need to create a geoprocessing tool with multiple output parameters that may or may not have values depending on the input parameters selected. If you have more than one output parameter that is a feature layer data type, you may get an error if you do not create a feature layer result for each output parameter.
To publish a geoprocessing service with an “empty” output parameter, I usually set the resulting output parameter to an empty feature class using the CreateFeatureClass function.
Conclusion
Getting your geoprocessing tools to successfully publish can take a lot of time and effort, especially when you are just getting started.
I hope this post saves you some time and decreases the amount of errors you see when you are publishing your geoprocessing tools. 🙂
Comment Below
What lessons have you learned while publishing geoprocessing services in ArcMap?
Post them in the comments section below!
Leave a Reply