2

I'm trying to find a way to build a custom raster mosaic operator. When I Mosaic different raster to a new raster ArcMap lets u chose between "first", "last", "max" etc. I need a operator that chooses not the maximum cell value but the second highest cell value. F.e. if I add 3 overlapping rasters, which contain values from 1 to 3, I want the resulting raster to be 2 instead of 3 (max) in the overlapping area. I thought this would be easily doable with a map algebra expression in the raster calculator, but can't make it work. So I was thinking a python tool, but I can't seem to get a good start. I checked out rastertonumpyarry and this might even work. But since the raster to new mosaic tool is already almost doing what I want (except for the "second highest cell value operator") I was hoping to find an easier way. Any ideas?

2
  1. Use Combine to collect all raster values into a single table:

enter image description here

  1. Calculate the second highest value into a new column, using Field Calculator Python expression like: sorted([ !att1! , !att2! , !att3! , !att4! ])[-2]
  2. Use Lookup tool to make new raster, using the calculated value from step 2.
  • tank you for your answer, but how am I supposed to get the values into a table? Combine produces a raster which a.f.a.i.k. has no attribute table. – fry82 Mar 13 '17 at 19:35
  • It creates an integer raster, which does have an attribute table. – phloem Mar 13 '17 at 19:50
0

I wanted to thank you again for your answer, phloem...this is a very nice and easy way to do it. Because of restrictions to the tool (only int and max number of rasters) I wound up converting my rasters to points a doing automated spatial joins, but still

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.