Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

sooorry guys! I already found the solution...

in GRASS GIS using the map calculator

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

soo easy... :)

share|improve this answer
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 '12 at 14:10
yes, you are right. I have to wait a while since only after 21 hours I can accept my own answer. – Jens Jan 12 '12 at 15:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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