# What is the syntax for a Maximum operator in ArcGIS

The requested maximum operator is a function that produces a new raster with the highest values on a cell-by-cell basis from an array of coincident input rasters. It is the kind of Maximum Support classification performed by the 'HARDEN' tool of the IDRISI software.

The raster calculator spatial analyst tool should be used.

I tried:

``````max("raster_A","Raster_B","Raster_C","Raster_D")
``````

But got the following error:

``````'exceptions.ValueError': The truth value of the raster is ambiguous
``````

I believe the "max" keyword in raster calculator was deprecated with the transition from ArcGIS 9.x to ArcGIS 10. So Rasto's answer probably won't work in ArcGIS 10 (it didn't for me when I just tried it).

If you have only two rasters, you can still make a condition statement to find the maximum using the "Con" keyword in map algebra. The syntax is

``````Con(LOGICAL_TEST,IF_TRUE,IF_FALSE)
``````

so to find the maximum of two rasters you'd do

``````Con("Raster1" > "Raster2","Raster1","Raster2")
``````

If you have more than two rasters, you can run Cell Statistics in Spatial Analyst with a "MAXIMUM" parameter on an arbitrarily number of inputs.

• Thanks Man! this (cell statistics) works, it's only that I need a map algebra syntax for 'maximum' on many (7) raster layers . I'm required to build a complex python expression upon this pls. – Hyipro Dec 13 '11 at 15:37
• You should be able to add as many raster layers as you want to the cell statistics geoprocessing tool. So Python would be outRaster = CellStatistics([Raster1,Raster2,Raster3,Raster4,Raster5,Raster6,Raster7], "MAXIMUM") – dmahr Dec 13 '11 at 15:45
• CellStatistics(["Raster1","Raster2","Raster3","Raster4","Raster5"],"MAXIMUM","DATA") – Hyipro Dec 13 '11 at 15:54
• No problem. Be sure to make this question as "answered" whenever you get a chance. – dmahr Dec 13 '11 at 15:58

I Just completed somthing similar, exept i used the Minimum parameter (on 700 rasters). If you are looking to execute the tool on more than two rasters use the list data method and then use it as the variable in the tool. Good Luck!

use max([raster_A],[Raster_B],[Raster_C],[Raster_D])

• Doesn't this just reproduce the syntax the OP found not to work? – whuber Dec 13 '11 at 17:33