I have a raster dataset in ArcGIS displaying altitude.

I want to replace all values < 8 with value 8.

Other values have to stay the same. How can I do this?

I tried raster calculator, but I don't seem to get the expression right.


With the raster calculator, you can use the Con() statement(condiotion, value if true, value if false)

Con("raster" < 8 , 8, "raster")
# Import system modules   
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/project/input/data"

# Execute Con
outCon = Con("altitude" < 8, 8, "altitude")

# Save the outputs 


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.