Publishing a GP Service with an Operational Layer

3382
13
Jump to solution
05-30-2018 12:24 PM
BlytheSpendlove1
New Contributor III

I am trying to publish a geoprocessing service that takes an input file from a web application, does a custom field calculation based on user defined integer inputs, and outputs a feature service that can be viewed and exported from the web application.

However, when I publish my geprocessing service and bring it into Web AppBuilder using the geoprocessing tool widget, I cannot choose the option "Add result as operational layer" and the output has the error "Can not set renderer because of unknown geometry type."

This is the REST URL for my geoprocessing service: WetlandPrioritization/WetlandPrioritizationTool_Ac (GPServer), and the screen shot below show my output parameter as having no geometry type.

Question 1) Does anybody know why I cannot see the geometry type? I am assuming this is the reason I cannot add my result as an operational layer.

Question 2) I am assuming the error above is why the tool will not run. But I also realized that I am using the python math module in my python script....Is that a problem? Do I need to download that module somehow onto my server, or can I assume the math module will work in the gp service?

My workflow for creating the Geoprocessing Service:

I created a script tool with a Feature Layer as the input, and a Feature Class as a derived output. 

I then ran the tool in ArcMap (10.5) and published the geoprocessing service onto my organization's server (version 10.5). For Parameters in the Service Editor, I chose "Asynchronous" and "View results with map service," as I believe I can view the gp service results as a map service in addition to whatever my normal outputs are (such as an operational layer). I also specified maximum number of records returned by the server  as 3000 because I have 2313 features in the input feature class that will be used by the tool. I then published the tool. 

I have attached the source code that my web tool is running.

Thanks!

0 Kudos
13 Replies
JonathanQuinn
Esri Notable Contributor

Turn on Info messages and then monitor the traffic using Fiddler or the dev tools in your browser to see the job status:

You can also run it at REST but need the correct syntax for the input feature layer, which you can set as a default through the service editor:

print statements also won't return in script tools or GP services, so you may want to review lines 58-63, (at least in the original script):

elif result:
        print(type(result))‍‍
else:
        # Raise custom exception
        raise WrongInputs(result)

If result is not equal to 1.0, then should it fail? You don't need the elif result line if anything other than 1.0 should fail.

BlytheSpendlove1
New Contributor III

Thank you! And yes, if the result is not equal to 1.0 it should fail. 

0 Kudos
by Anonymous User
Not applicable

If you're executing this primarily through a WAB Dev edition app, you can also modify the message settings of the GP widget (during the testing phase) so you can see all the messages after the script runs (https://community.esri.com/thread/200639-wab-how-do-i-customize-output-messages-in-gp-widget-output-... )

BlytheSpendlove1
New Contributor III

Thank you! That is helpful to know!

0 Kudos