2

I'm trying to update some values of a raster based on another raster.

1st raster (A): landuse data (values from 10 to 240)

2nd raster (B): mask data (only nodata values and a given value, for example: 20)

Objective: for a given pixel, if Pixel A == 212 and Pixel B == 20, replace pixel A with pixel B value.

So, my 1st command is: B*(A==212). That works fine, I'm getting a raster with pixels that matches the objectives and with the new value.

I'm having problems with the second raster manipulation. I dont know how to get a new full raster with values updated.

Anyone have an idea of how I can do that in, if possible, only one math formula ?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 26, 2016 at 17:26

1 Answer 1

2

the test yields either 1 (true) or 0 (false). So you can make an "and" by multiplying the results, and the othe cases using 1-(condition). Here ismy suggestion

B*(A==212)*(B==20) + A*(1-(A==212)*(B==20))
answered Apr 26, 2016 at 18:31

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.