MapInfo Pro

Expand all | Collapse all

Left join on two mrr files using "Raster Calculator"

  • 1.  Left join on two mrr files using "Raster Calculator"

    Posted 02-27-2020 18:59
    Hi Team,

    I am bit new to the mapinfo and wanted to have little guidance here. I have two .mrr files, lets say A and B. I need to perform left join (image example below) on them. I see that the option for doing that could be by using "raster calculator" (please let me know if there is a better and efficient way of doing that).

    For the calculator I am using the below expression, please let me know if this query expression would work or should I make any changes to it.

    cond(Input_2 <> null, Input_1, null)

    Input_2 = A
    Input_1 = B


    Thanks,
    Vibhore


    ------------------------------
    Vibhore Agarwal
    Knowledge Community Shared Account
    ------------------------------


  • 2.  RE: Left join on two mrr files using "Raster Calculator"

    Pitney Bowes
    Posted 02-28-2020 04:24
    Edited by Anshul Goel 02-28-2020 05:13
    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
    ------------------------------



  • 3.  RE: Left join on two mrr files using "Raster Calculator"

    Posted 02-28-2020 13:31
    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
    ------------------------------



  • 4.  RE: Left join on two mrr files using "Raster Calculator"

    Pitney Bowes
    Posted 03-01-2020 16:19
    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
    ------------------------------