0

I"m trying to nest expressions in this raster calculator conditional statement, but I get an error.

This statement works, so I tried to follow it as a template:

Con (IsNull("ras1"),"ras2","ras3")

Separately, this statement works

"rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=20)

And I'd love to merge them into one calulation liek this

Con(IsNull("rasA"),
("rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=20),
("rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=500))))

Where "rasA" is null, return "rasB"-(5+(1/(1+"rasC"))5)("RasD"<=20). Otherwise return "rasB"-(5+(1/(1+"rasC"))5)("RasD"<=500)

I get the error shown below so I'm trying to figure out if Con() requires a layer like the error says or if can I use an expression and I just entered it wrong.

enter image description here

1
  • 1
    Please remember to place the complete error text in the question as ASCII. This makes it legible on all platforms and available for search by others.
    – Vince
    Mar 26, 2019 at 21:18

1 Answer 1

0

Your parentheses are incorrect. You have parentheses around both the True and False expressions, i.e:

Con(condition, (true_expression, false_expression))

It should be:

Con(condition, true_expression, false_expression)

Try:

Con(IsNull("rasA"), "rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=20), "rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=500))

Or:

Con(IsNull("rasA"), ("rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=20)), ("rasB"-(5+(1/(1+"rasC"))*5)*("RasD"<=500)))
1
  • Parentheses...I always miss some mundane detail like that! point of clarification... in your answer, instead of Con(condition, true_expression, true_expression) should it be Con(condition, true_expression, FALSE_expression) ?
    – Zipper1365
    Mar 27, 2019 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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