0

I am using ArcGIS Pro 2.4.

In the following equation, can "X" be replaced with the maximum cell value of another raster? Alternately, replacing "X" with a field from a table would work.

Con("udlen", 1, 0, "Value > X")

2 Answers 2

4

Yes. Raster objects have a maximum property. Just make sure statistics have been calculated for the raster or maximum will return None.

E.g.

Con("my_raster.tif" > "other_raster.tif".maximum, value_if_true, value_if_false)
3
  • 1
    +1 never thought it's possible.
    – FelixIP
    Feb 11, 2020 at 5:19
  • Yes! Thank you user2856 - That solution worked perfectly!!
    – Jim-wy
    Feb 11, 2020 at 5:50
  • @FelixIP this has worked since ArcGIS10.0
    – user2856
    Feb 11, 2020 at 6:47
0

You could use the MAXIMUM argument in arcpy.GetRasterProperties_management() to get the highest cell value in the raster. See the documentation for Get Raster Properties (Data Management).

eg, x = arcpy.GetRasterProperties_management("udlen", "MAXIMUM")

Is that what you're after?

3
  • I'm using ModelBuilder and am hoping to populate the value within the raster calculator. I also have the option of creating a table with the max value and have been trying to figure out how to extract the data from the table. Looks like I need to step up my Python education - but I am hoping to do this within Model Builder for now.
    – Jim-wy
    Feb 11, 2020 at 5:09
  • The other answer from @user2856 looks like a better option, anyhow. Feb 11, 2020 at 5:12
  • Thank you - I'll be trying your solution in Python also, I appreciate the input!
    – Jim-wy
    Feb 11, 2020 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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