1

At Sharing ArcGIS Pro Python Script as Web Tool gives Analyze error 00068 Script ... contains broken project data source I learned how to fix my paths, use a scratch geodatabase and employ a Result object when sharing a working Python Script Tool as a geoprocessing service.

The result of my current tool/service is a point feature class in a scratch geodatabase that I wish to display on the web map that I run the Web Tool from.

This is the code that runs fine in ArcGIS Pro 3.0.2 and which I have no problem Sharing as a Web Tool to our ArcGIS Enterprise 11 portal using the settings below.

import arcpy,os

arcpy.env.overwriteOutput = True

csvFile = arcpy.GetParameterAsText(0)
test_data_name = arcpy.GetParameterAsText(1)

gdb = arcpy.env.scratchGDB
csv_table_name = "{0}_CSV".format(test_data_name)
csv_table = os.path.join(gdb,csv_table_name)
pointFC_name = "{0}_points".format(test_data_name)
pointFC =  os.path.join(gdb,pointFC_name)
srGDA2020 = arcpy.SpatialReference("GDA2020")

t2t = arcpy.conversion.TableToTable(csvFile,arcpy.env.scratchGDB,csv_table_name)
arcpy.management.XYTableToPoint(t2t,pointFC,"Longitude","Latitude",None,srGDA2020)

Note that on the Configuration tab I use the Upload option, and this works fine to enable me to browse to an input CSV file. I also use the View output in map image layer option hoping that would enable the point feature class my tool creates to be rendered in my web map.

enter image description here

enter image description here

When I locate my Web Tool in the Contents of my Portal and choose Open in Map Viewer Classic, it gives me to GUI that I expect:

enter image description here

However, when I click RUN ANALYSIS the analysis appears to run but instead of seeing its result added to the web map I get a message:

Error

The layer, Analysis Result Layer, cannot be added to the map.

At suggestion of @user2856 I used ArcGIS Server Manager to look at the Logs and found more information about the error:

Can not open file E:\arcgis\arcgisserver\directories\arcgisjobs\testtool_gpserver\j529678a532724ddab9f9469b5a754bfc\Results.msd. The system cannot find the file specified. Probable cause: The file is inaccessible to Server.

enter image description here

Unfortunately, that message does not yet mean much to me, but I'll see what I can find out about it from those who administer ArcGIS Enterprise here.

How do I get a feature class that my web tool creates in a scratch geodatabase to be displayed in the web map that I run it from?

0

1 Answer 1

0

I was able to get past this without needing to directly address the error seen in the ArcGIS Server Manager by:

  1. Modifying my code to include arcpy.SetParameter() at its end

import arcpy,os

arcpy.env.overwriteOutput = True

csvFile = arcpy.GetParameterAsText(0)
test_data_name = arcpy.GetParameterAsText(1)

gdb = arcpy.env.scratchGDB
csv_table_name = "{0}_CSV".format(test_data_name)
csv_table = os.path.join(gdb,csv_table_name)
pointFC_name = "{0}_points".format(test_data_name)
pointFC =  os.path.join(gdb,pointFC_name)
srGDA2020 = arcpy.SpatialReference("GDA2020")


t2t = arcpy.conversion.TableToTable(csvFile,arcpy.env.scratchGDB,csv_table_name)
result = arcpy.management.XYTableToPoint(t2t,pointFC,"Longitude","Latitude",None,srGDA2020)
arcpy.SetParameter(2,result)

  1. Modifying the Python Script Tool properties to include the parameter I set in my script as FeatureClass, Derived and Output.

enter image description here

  1. Sharing as Web Tool again
  2. Testing it in Map Viewer Classic

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.