1

I am trying to execute a conditional statement using Python and ArcGIS 10.1 that looks something like this:

outRas = Con( MAJORITY (raster1, raster2, raster3, raster4) > 110, 1, 0)

The idea is that I want to check if the most common value for the current pixel among the provided rasters is greater than 110, and if so, assign a value of 1 to the output raster. Of course, there is no such function called MAJORITY, however I'm wondering if there is something equivalent, or if anyone knows of any other way to achieve this.

4

I think you could use Cell Statistics to get the majority of those input rasters and create a new raster. Then use Con on the new raster.

cellStats = CellStatistics(["raster1", "raster2", "raster3"..], "MAJORITY")
outRas = Con(cellStats > 110, 1, 0)

Something like that might work..

  • This works great, not sure why I didn't think of it. Cell statistics runs very quickly as well! – BruceDoh Jul 14 '15 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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