2

I have created a model in ModelBuilder and I need to pass a list of rasters from my code (C#) but until now, ModelBuilder gets only the first record in the array.

I have been passing it in different ways like:

IVariantArray parameters = new VarArrayClass();
parameters.Add(lstRoots);//lstRoots is a list of strings with the root of the raster.

Other way:

foreach (string r in lstRoots) //lstRoots is a list of strings with the root of the raster.
{
   parameters.Add(r);
}

And another way:

IVariantArray parameters = new VarArrayClass();
IVariantArray paramlist = new VarArrayClass();

foreach (string r in lstRoots) 
{
   paramList.Add(r);

}
parameters.Add(paramList);
result = (IGeoProcessorResult)GP.Execute("ModelCellStatistics", parameters, null);

In the model I have created a variable that is the parameter with multiple values:

enter image description here

1 Answer 1

0

I can solved using layers.name!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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