I have two rasters. Raster1 is a reclassified raster for certain elevation value ranges. Raster2 is an elevation raster too but with gaps. I want to fill the gaps of Raster2 by the median of the elevation class of Raster1. But Raster1 is only used to give the class areas. So I want to calculate the median of Raster1 taking the elevation classes/areas of Raster2 and save them to the gaps of Raster1.

The theoretical idea is more or less clear but I don't know how to create the raster calculator statement.


1 Answer 1


OK. You need Zonal Statistics using median.

1) Raster 1 is your zones raster and the zone field is the field that differentiates the classes, usually but not always 'Value'. Your analysis raster is Raster 2.

The output will be the median of each class (Raster 3).

2) Now you the Con Function on Raster 2. Use the Con IsNull statement to convert the no data values to the median.

enter image description here

 Con(in_conditional_raster, true_raster, {false_raster}) 

Your condition raster is raster 2. Your true raster is is Raster 3. Your false raster is raster 2. Your condition is IsNull

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.