I would like to change all raster values in raster A that fall into the locations of category/class 1 of raster B.

Here, some more details. I did a calculation on a DEM resulting in different topography layers which I summed up to raster A. Now, I have a polygon map which I transferred into raster B. The class 1 of raster B should be an area that has only values of 1 in raster A. So I would like to use map algebra to change this (perhaps using a complex if() statement in GRASS GIS?)

I think I could have prevented all this earlier by simply applying a mask to the raster A before the calculations. However, the calculations took quite a while (2hours) so I would not like to repeat all the steps again...

any help is very much appreciated! Jens

1 Answer 1


sooorry guys! I already found the solution...

in GRASS GIS using the map calculator

if(rasterA == 1, rasterB == 0, rasterB)

soo easy... :)

  • quite alright, just go ahead and select as the right answer, Maybe it would help others to know how/where you came across the answer.
    – Brad Nesom
    Jan 11, 2012 at 14:10

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.