Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a custom geoprocessing tool called "CreateCoverLayer". It has no input or output parameters. I have the following snippet of code, but get an error message due to the fact that the Execute method is looking for an array of parameters as the second input argument. Can I use this tool with no parameters, or is that not possible? Thanks!

IGeoProcessor2 gp = new GeoProcessorClass();    
gp.Execute("CreateCoverLayer", null, null);
share|improve this question
Did you try passing an empty array? – Kirk Kuykendall May 24 '13 at 18:54
Yes, I also tried this . . . – Renee Cammarere May 24 '13 at 19:10
IGeoProcessor2 gp = new GeoProcessorClass(); gp.AddToolbox(@"C:\TestToolbox.tbx"); IVariantArray parameters = new VarArrayClass();gp.Execute("CreateCoverLayer", parameters, null); – Renee Cammarere May 24 '13 at 19:11
That should work. What happens when you use an empty IVariantArray? – blah238 May 25 '13 at 4:10
The above code (sending in the empty array) did work, so I'm all set. – Renee Cammarere May 29 '13 at 14:21

Try using the geoprocessor managed assembly instead of the geoprocessing one. You can call execute without a parameter variable, as shown with the system delete below, but im not sure what it will do with a custom tool.

Geoprocessor gp = new Geoprocessor();
DeleteFeatures delete = new DeleteFeatures();
delete.in_features = layer;
gp.Execute(delete, null);
share|improve this answer
Yes, I've also used this type of code and was successful . . . – Renee Cammarere May 29 '13 at 14:25
ESRI.ArcGIS.Geoprocessor.Geoprocessor GP = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); CopyFeatures copyFeatures = new CopyFeatures(); copyFeatures.in_features = @"C:\FOBSP.gdb\BrigadeAOI"; copyFeatures.out_feature_class = @"C:\Data\BrigadeAOIcopy.shp"; RunTool(GP, copyFeatures, null); – Renee Cammarere May 29 '13 at 14:28
up vote 2 down vote accepted

The following code did work . . .

IGeoProcessor2 gp = new GeoProcessorClass(); 
IVariantArray parameters = new VarArrayClass();
gp.Execute("CreateCoverLayer", parameters, null); 

Sending in the empty array did the trick.

share|improve this answer

Your Answer


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

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