I want to use r.mapcalc to calculate a raster from two inputs: water_rst and contour_rst. I need a raster with all values from water_rst and then values from contour_rst where water_rst has no data.

An expression like comb_rst = not(if(water_rst))*contour_rst produces raster with only contour values, but no initial water values. How to modify this expression to get both water values and contours?


1 Answer 1


This expression does the trick: if(isnull(water_rst), contour_rst, water_rst)

Your Answer

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

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