Your expression is like this -
IF (B is Valid)
THEN
Output B
ELSE
Output A
Firstly, to reduce confusion, you can change the "Alias" names for the rasters from "Input_1", "Input_2" etc to something that makes sense like "A" and "B". Just click on the alias name to edit it in the dialog.
cond(expression, then, else)
The "cond" function is an IF statement where you evaluate an expression and if it is true then the first value is output. If it is false then the second value is output. You can nest cond() statements to get more complicated expressions and outputs.
So the expression below will do the trick -
cond(B<>null,B,A)
In fact, you don't need to be so verbose. It still works if you just use this -
cond(B,B,A)
If you wanted the opposite then you would use this -
cond(A,A,B)
Note that the "String null handling" option has no impact on this expression. This flag is taken into account when evaluating an expression. When turned on, if any input value in an expression is null, then the result will be null. When turned off the expression may still be evaluated, but not always. If you have a simple expression like "A+B" you can see the effect of this. When turned on you get the intersection of A and B and when turned off you get the union of A and B.
------------------------------
Sam Roberts
Engineer, MapInfo Pro Advanced (Raster)
Australia
------------------------------
Original Message:
Sent: 02-28-2020 13:30
From: Vibhore Agarwal
Subject: Left join on two mrr files using "Raster Calculator"
Hi Anshul,
Thanks for responding back.
I'm trying to do a spatial join on two continuous Rasters. I want to have all the pixels with values from Raster A where Raster B has null or no values. Something similar to what we call as left join. To achieve this, I am using the "calculator" from "Raster Operations" and have provided the below query:
cond(Input_1 <> null, Input_2, null)
Here input_2 is Raster A
and input_1 is Raster B
Please let me know if this provides little clarity.
Thanks,
Vibhore
------------------------------
Vibhore Agarwal
Knowledge Community Shared Account
Original Message:
Sent: 02-28-2020 04:24
From: Anshul Goel
Subject: Left join on two mrr files using "Raster Calculator"
Hi Vibhore,
Can you provide more information on the type of Raster you are using (Continuous, Classified, Palette or imagery) and more information on what you are trying to achieve?
The calculator tool cannot be used to left join Raster data. If the Raster is a classified file having multiple attributes then it needs to be vectorized before running a join operation.
Feel free to share more information on the same.
Thanks
Anshul
------------------------------
Anshul Goel
Knowledge Community Shared Account
Shelton CT
Original Message:
Sent: 02-27-2020 18:58
From: Vibhore Agarwal
Subject: Left join on two mrr files using "Raster Calculator"
------------------------------
Vibhore Agarwal
Knowledge Community Shared Account
------------------------------