Select to view content in your preferred language

WAB Geoprocessing: how to add feature layer output to map

192
2
Jump to solution
05-16-2024 05:27 AM
DonMorrison1
Occasional Contributor III

I have a  ArcGIS Pro 2.9.12  python toolbox tool that adds a feature layer to a map. A simplified version is below. It works fine in ArcGIS Pro, but when I publish it to my ArcGIS 10.6 Server I can't figure out how to achieve the same effect where the user runs an AGOL WAB geoprocessing widget and the result is a new layer in the map.  Here are the relevant parts of the tool

 

    def getParameterInfo(self):
        return [arcpy.Parameter(displayName="States", name="states",  datatype="GPFeatureLayer",  parameterType="Derived",  direction="Output")]

    def execute(self, parameters, messages):
        db_dir = r'C:\Users\dmorri28\Documents\ArcGIS\Projects\MyProject\CC-SQL2k16-ERC-SDE.sde'
        feature_class = os.path.join(db_dir, "ROW_Habitat.SDE.USA_States_Generalized_Trimmed")
        
        layer_name = "States"                                  
        lyr = arcpy.MakeFeatureLayer_management(feature_class, layer_name)[0]
        
        arcpy.SetParameter(0, lyr)

 

 

Here are the publishing options

DonMorrison1_0-1715861164423.png

 I've tried various combinations and nothing works. I do see various errors in the server manager log:

  • Can not open file c:\arcgisserver\directories\arcgisjobs\testing_only\states_gpserver\j8ca6a20d8a324d2dbbfad9bccb56cd79\Results.msd. The system cannot find the file specified. Probable cause: The file is inaccessible to Server.   (that file does not exist at the location)
  • Failed to find the map.
  • Instance of the service 'TESTING_Only/States.GPServer' crashed. Please see if an error report was generated in 'C:\arcgisserver\logs\ERC-ROW01.AD.UIC.EDU\errorreports'. To send an error report to Esri, compose an e-mail to ArcGISErrorReport@esri.com and attach the error report file. (nothing there)

Do anybody know the secret to making this work? 

 

0 Kudos
1 Solution

Accepted Solutions
DonMorrison1
Occasional Contributor III

After working with ESRI customer support we determined that this could be fixed by upgrading the ArcGIS Pro client and the ArcGIS Server to the latest releases (3.3 and 11.3)

View solution in original post

0 Kudos
2 Replies
DonMorrison1
Occasional Contributor III

When I change the output parameter data type from GPFeatureLayer to GPLayer,  the WAB widget starts allowing me to set the symbology and allows me to "Add result as operational layer" without "View result with a map service" which is progress and I think is what I want (I'm not sure of the pros and cons of viewing with a map service - do I need it?). However when I run it this way the widget completes with a message "The result is empty."  There are no errors in the service log, and from the browser network trace I see this being returned from the server 

 

 

{jobId: "jd972954c64554cecaab51457add1b7df", jobStatus: "esriJobSucceeded",…}
inputs
: 
{}
jobId
: 
"jd972954c64554cecaab51457add1b7df"
jobStatus
: 
"esriJobSucceeded"
messages
: 
[,…]
0
: 
{type: "esriJobMessageTypeInformative", description: "Start Time: Thursday, May 16, 2024 10:25:41 AM"}
description
: 
"Start Time: Thursday, May 16, 2024 10:25:41 AM"
type
: 
"esriJobMessageTypeInformative"
1
: 
{type: "esriJobMessageTypeInformative", description: "Start Time: Thursday, May 16, 2024 10:25:41 AM"}
description
: 
"Start Time: Thursday, May 16, 2024 10:25:41 AM"
type
: 
"esriJobMessageTypeInformative"
2
: 
{type: "esriJobMessageTypeInformative", description: "Running script States..."}
description
: 
"Running script States..."
type
: 
"esriJobMessageTypeInformative"
3
: 
{type: "esriJobMessageTypeInformative", description: "Completed script States..."}
description
: 
"Completed script States..."
type
: 
"esriJobMessageTypeInformative"
4
: 
{type: "esriJobMessageTypeInformative",…}
description
: 
"Succeeded at Thursday, May 16, 2024 10:25:44 AM (Elapsed Time: 2.67 seconds)"
type
: 
"esriJobMessageTypeInformative"
5
: 
{type: "esriJobMessageTypeInformative",…}
description
: 
"Succeeded at Thursday, May 16, 2024 10:25:44 AM (Elapsed Time: 2.68 seconds)"
type
: 
"esriJobMessageTypeInformative"
results
: 
{states: {paramUrl: "results/states"}}

 

 

 

 

 

0 Kudos
DonMorrison1
Occasional Contributor III

After working with ESRI customer support we determined that this could be fixed by upgrading the ArcGIS Pro client and the ArcGIS Server to the latest releases (3.3 and 11.3)

0 Kudos