0

I need some help with mapcalc.

I have two rasters:

  • A contains cells with 1 or 2 or null;

  • B has values>=1 or null.

I would like to delete areas where A overlaps with B, then get a resulting map where there is 1 where B has a value>=1 and null where both A and B have >= 1.

It seems easy but I'm trying many different combinations unsuccessfully.

  • What do you mean with I would like to delete areas...? – mgri Jul 13 '17 at 20:09
  • I mean that I would like to have null where both A and B have 1. – Dean Jul 14 '17 at 9:20
  • Do have both raster same extension and they are perfectly aligned? – xunilk Jul 14 '17 at 15:34
  • Yes, both raster have same extension and they are perfectly aligned. – Dean Jul 15 '17 at 11:35
1

It should be

g.region -p rast=A,B
r.mapcalc "C = if(A==1 && B==1, null(), if(B>=1, 1))"
  • It does just the opposite! Only the overlapping areas are conserved. – Dean Jul 16 '17 at 9:00
  • I solved it using one layer as a mask and mapcalc. – Dean Aug 22 '17 at 8:46

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.