Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

Thanks in anticipation

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
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
1  
CellStatistics(["Raster1","Raster2","Raster3","Raster4","Raster5"],"MAXIMUM","DA‌​TA") –  Hyipro Dec 13 '11 at 15:54
    
thanks a million, This works perfectly. U're the Best! –  Hyipro Dec 13 '11 at 15:56
    
No problem. Be sure to make this question as "answered" whenever you get a chance. –  dmahr Dec 13 '11 at 15:58
add comment

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!

share|improve this answer
add comment

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

share|improve this answer
    
Doesn't this just reproduce the syntax the OP found not to work? –  whuber Dec 13 '11 at 17:33
add comment

Your Answer

 
discard

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.