Select to view content in your preferred language

GP Service Publishing Succeeds but Fails in AGOL

162
0
05-27-2024 11:44 AM
baadminAdmin
New Contributor

Hi,

I've been tasked with publishing a geoprocessing service that will perform a simple intersect between 2 feature services that the user chooses from a web map. The first thing to know is that we can only publish from ArcMap because our server is 10.8. Anyway, I created a model using ModelBuilder and have been able to successfully publish and deploy that in a web application. We'd like to create a script to do the same thing so that we can build on it later. I've been able to successfully publish a geoprocessing service using a script, but it fails when I try to use the service, whether I "hit" the geoprocessing service through ArcMap or I add it to a geoprocessing widget in Web AppBuilder. (The client app is built on the older platform, which is why I'm in WAB.)

I have shared my most-recent script attempt below with the error I receive when I try to use the service, but I am also thinking the answer might be really simple like, "for the script to work you need to leverage the arcgis api for python, which isn't an option in the arcmap environment so this will never work." I hope that isn't the answer, but wanted to acknowledge that very well could be the answer. 🙂

Thanks for any help you can provide.

*********script**************

import arcpy

def main():

arcpy.AddMessage("Starting intersect script")

# Get the selected feature layers from parameters
feature_layer_1 = arcpy.GetParameterAsText(0)
feature_layer_2 = arcpy.GetParameterAsText(1)

# Define output feature class
output_feature_class = arcpy.GetParameterAsText(2)

# Create FeatureSet objects from the selected layers
arcpy.AddMessage("Create the feature sets!")
feature_set_1 = arcpy.FeatureSet(feature_layer_1)
feature_set_2 = arcpy.FeatureSet(feature_layer_2)

# Perform the intersect analysis
arcpy.AddMessage("Do the intersect!")
arcpy.Intersect_analysis([feature_set_1, feature_set_2], output_feature_class)

# Set output parameter
arcpy.SetParameterAsText(2, output_feature_class)

if __name__ == '__main__':
main()

The error is:

RuntimeError: RecordSetObject: Cannot open table for Load

By the by, I started with a much simpler script that just passed the feature services into the intersect. Again I was able to successfully run that as a script tool in ArcMap and publish it as a gp service, but when I tried to use the service the error I received was that the feature service "does not exist or is not supported" for both the feature services.

Thanks again for the help.

0 Kudos
0 Replies