Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm attempting to publish a toolbox to ArcGIS Server. The toolbox contains a model and a custom python script. The model calls the script. It runs fine in the desktop but when I publish as a service I'm given a code 500 Error Executing Task. Error executing tool.

My model takes a featureset as a parameter which can have different fields each time. My end goal is to run an intersect against this featureset and add up the values of a field for all intersecting features.

My model works as follows: Make a feature layer from the featureset -> select features that intersect with another layer -> save the selection to my scratchworkspace > run summary statistics using my python script

I need the script because I don't know what the field is going to be called. The field name is also a parameter to the model. My script does the following:

Input_features = arcpy.GetParameterAsText(0) Input_metric = arcpy.GetParameterAsText(1) Output_table = "GetFieldValue.dbf"

arcpy.Statistics_analysis(Input_features, Output_table, [[Input_metric, "SUM"]]) arcpy.SetParameterAsText(1, Output_table)

As i say this works fun in ArcGIS desktop. My script has 3 parameters:

Input_features - FeatureSet Input_metric - String Output_table - Table or String - fails either way!

I'm dubious about this last output as appreciate I declare Output_table as a string above.

Anyhow, I publish the whole lot storing relative path names for both model and script. I set it to run synchronously and to run python script in progress.

My js code calls the service as follows: var metric = "METRIC_1"

// setup params and execute var params = { "Buffers" : bufferFeatureSet, "Metrics" : metricsFeatureSet, "Input_metric": metric }; gpIntersects.execute(params, handleGpIntersectSuccess, handleQueryError);

I land at handleQueryError every time!

Has anyone got any suggestions or advice as I'm struggling....

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.