Select to view content in your preferred language

Sum raster layers

828
5
08-26-2010 02:29 AM
Ahmed_Wagih_Abdel-LatifAzab
Emerging Contributor
Dear All,

How can I sum a number of Grids loaded in the table of contents (I don't know the number of layers) in ArcObjects .NET?

Regards,
0 Kudos
5 Replies
KirkKuykendall
Deactivated User
0 Kudos
Ahmed_Wagih_Abdel-LatifAzab
Emerging Contributor
Yes, but the problem is that I want to sum all the layers in the table of contents, and I don't know before hand how many they are!


Regards,
0 Kudos
Ahmed_Wagih_Abdel-LatifAzab
Emerging Contributor
I was thinking of using IGPSAWeightedSum but I can't find any reference to its usage!
0 Kudos
KirkKuykendall
Deactivated User
The code at the link I posted could be modified to sum all rasters in the TOC.
0 Kudos
Ahmed_Wagih_Abdel-LatifAzab
Emerging Contributor
Thanks Kirk, but how would you represent an array of rasterlayers (rasterlayer(i)) in the script? The following equation in the code seems to be rigid to me!

rasterModel.Script = "[out] = [in01] + [in02]"
0 Kudos