Different behavior when I run geoprocessing tool from SDK and from ArcDesktop ModelBuilder

518
2
02-20-2019 02:49 AM
AndreasAndreou
New Contributor

I have a large JSON file which I download from ArcGIS Server REST (size is 140MB). When I try to execute the JSONToFeatures Geoprocessing tool on this file I get an error.

I have the method below which I call from various parts of my solution to run various geoprocessing tools. (in this case I call below method with arguments toolName="JSONToFeatures", a path for input json and a path for output SHP file).

    private object RunTool(string toolName, object[] parameters) {         IVariantArray gpParams = new VarArrayClass();         IGeoProcessorResult gpResult = new GeoProcessorResult();         foreach (object o in parameters)             gpParams.Add(o);         object rev = new object();         try {             gpResult = Geoprocessor.Execute(toolName, gpParams, null);             return gpResult.ReturnValue;         }          catch (COMException comEx) {             throw new Exception(Geoprocessor.GetMessages(ref rev), comEx);         }          finally {             ReleaseObjects(new object[] { gpParams, gpResult });         }     }

When executed returns the following error: Executing: JSONToFeatures input_path output_path Start Time: Thu Jan 31 14:32:43 2019 ERROR 999998: Unexpected Error. Failed to execute (JSONToFeatures). Failed at Thu Jan 31 14:32:45 2019 (Elapsed Time: 1,48 seconds)

When I execute JSONToFeatures tool from within ArcDesktop ModelBuilder execution proceeds successfully.

Please note that on small files of size 1-10 MB (which is the normal size of files processed by the code above) there are no problems.

How can I proceed with this?

0 Kudos
2 Replies
DuncanHornby
MVP Notable Contributor

Suggest you reformat your code as it is impossible to read! You set the format by going to the 3 dots > More option > Syntax highlighter.

0 Kudos
MichaelKohler
Occasional Contributor II

Check the tool name in the catalog window. I just spent more than a day trying to fix an issue calling a model from .net addin. Tech Support eventually walked through it with me. Ended up being the tool/model name was not as it seems. If you create a model in a toolbox and then change the name of the model by right clicking and choosing Rename, the model retains its original name. When calling the model from outside, the name is wrong and gives an error. Point is, if you rename a model, do it in the model builder application.

difference of model name from what is shown

0 Kudos