"Cannot add field [X] to [...]" Error in Geoprocessing

799
1
Jump to solution
03-11-2013 05:13 AM
KevinYanuk
Occasional Contributor
Hello, back once more with a Geoprocessing object error ...

I am trying to perform a Getis-Ord analysis for one of my applications (written in C#), and I'm getting an error that I cannot add a field created from the analysis into the new feature class.  My code is the following:

            gp.AddToolbox(@"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Spatial Statistics Tools.tbx");             IVariantArray parameters = new ESRI.ArcGIS.esriSystem.VarArrayClass();             parameters.Add(DatabaseUtils.ScratchDBPath + "\\" + inFeature);             parameters.Add(field);             parameters.Add(DatabaseUtils.FGDBPath + "\\" + outFeature);             parameters.Add("INVERSE_DISTANCE");             parameters.Add("EUCLIDEAN_DISTANCE");             parameters.Add("NONE");             parameters.Add(200);             try             {                 IGeoProcessorResult res = (IGeoProcessorResult)gp.Execute("HotSpots", parameters, null);             }             catch (System.AccessViolationException avEx) { avEx.emailError(gp); }             catch (System.IO.FileLoadException flEx) { flEx.emailError(gp); }             catch (Exception ex) { ex.emailError(gp); }             finally { gp = null; }


This is also in the error:

A column was specified that does not exist.
A column was specified that does not exist.
A locator with this name does not exist.
Failed to execute (HotSpots).


One thing to note is that I am deleting an existing feature class in an SDE database (programmatically), and creating a new one with the same name using the analysis ... I don't think this has anything to do with this, considering the feature class looks to be created, but the fields are not added.
0 Kudos
1 Solution

Accepted Solutions
KevinYanuk
Occasional Contributor
Hello, back once more with a Geoprocessing object error ...

I am trying to perform a Getis-Ord analysis for one of my applications (written in C#), and I'm getting an error that I cannot add a field created from the analysis into the new feature class.  My code is the following:

            gp.AddToolbox(@"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Spatial Statistics Tools.tbx");             IVariantArray parameters = new ESRI.ArcGIS.esriSystem.VarArrayClass();             parameters.Add(DatabaseUtils.ScratchDBPath + "\\" + inFeature);             parameters.Add(field);             parameters.Add(DatabaseUtils.FGDBPath + "\\" + outFeature);             parameters.Add("INVERSE_DISTANCE");             parameters.Add("EUCLIDEAN_DISTANCE");             parameters.Add("NONE");             parameters.Add(200);             try             {                 IGeoProcessorResult res = (IGeoProcessorResult)gp.Execute("HotSpots", parameters, null);             }             catch (System.AccessViolationException avEx) { avEx.emailError(gp); }             catch (System.IO.FileLoadException flEx) { flEx.emailError(gp); }             catch (Exception ex) { ex.emailError(gp); }             finally { gp = null; }


This is also in the error:

A column was specified that does not exist.
A column was specified that does not exist.
A locator with this name does not exist.
Failed to execute (HotSpots).


One thing to note is that I am deleting an existing feature class in an SDE database (programmatically), and creating a new one with the same name using the analysis ... I don't think this has anything to do with this, considering the feature class looks to be created, but the fields are not added.



EDIT - FIX - I had been deleting the feature class before creating it again with the same name, and this was giving me issue - I simply deleted the original, gave the new a temp name, and renamed it programmatically, which solved the problem.

View solution in original post

0 Kudos
1 Reply
KevinYanuk
Occasional Contributor
Hello, back once more with a Geoprocessing object error ...

I am trying to perform a Getis-Ord analysis for one of my applications (written in C#), and I'm getting an error that I cannot add a field created from the analysis into the new feature class.  My code is the following:

            gp.AddToolbox(@"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Spatial Statistics Tools.tbx");             IVariantArray parameters = new ESRI.ArcGIS.esriSystem.VarArrayClass();             parameters.Add(DatabaseUtils.ScratchDBPath + "\\" + inFeature);             parameters.Add(field);             parameters.Add(DatabaseUtils.FGDBPath + "\\" + outFeature);             parameters.Add("INVERSE_DISTANCE");             parameters.Add("EUCLIDEAN_DISTANCE");             parameters.Add("NONE");             parameters.Add(200);             try             {                 IGeoProcessorResult res = (IGeoProcessorResult)gp.Execute("HotSpots", parameters, null);             }             catch (System.AccessViolationException avEx) { avEx.emailError(gp); }             catch (System.IO.FileLoadException flEx) { flEx.emailError(gp); }             catch (Exception ex) { ex.emailError(gp); }             finally { gp = null; }


This is also in the error:

A column was specified that does not exist.
A column was specified that does not exist.
A locator with this name does not exist.
Failed to execute (HotSpots).


One thing to note is that I am deleting an existing feature class in an SDE database (programmatically), and creating a new one with the same name using the analysis ... I don't think this has anything to do with this, considering the feature class looks to be created, but the fields are not added.



EDIT - FIX - I had been deleting the feature class before creating it again with the same name, and this was giving me issue - I simply deleted the original, gave the new a temp name, and renamed it programmatically, which solved the problem.
0 Kudos