Select to view content in your preferred language

Map Algebra - CON statement with list (IN {}) do not work properly

426
3
10-28-2010 11:11 PM
MarcinGasior
Regular Contributor
The following Map Algebra expression in AV9.3 don't work properly:

CON([ingrid1] == 0, 0, CON([ingrid2] IN {3, 4, 5, 7, 8, 9, 13, 18}, 10, 20))

When the condition for [ingrid2] is satisfied, the value 10 is present in output raster. But when [ingrid2] is not in list, cells have NoData instead of 20.

When the list is written out for a series of 'OR' statements, the whole expression works ok.


Do you have any idea?
0 Kudos
3 Replies
MarcinGasior
Regular Contributor
Thank you, Bill. Your answer solves the problem:)
0 Kudos
MarcinGasior
Regular Contributor
Unfortunatelly it solves the problem in Raster Calculator only.

I tried to run this expression in Single Output Map Algebra (SOMA):
CON((D:\tmpGIS\C_br_Diff.img == 0), 0, CON((IsNull(D:\tmpGIS\C_br_2050.img IN {3, 4, 5, 7, 8, 9, 13, 18})), 20,10))

SOMA throws an error:
ERROR 010394: Map Algebra expression: Syntax error at location 53 (around D:\tm) of expression...

I tried several combination of spaces and patentheses but didn't help. Also data in different source doesn't help.

But when I delete 'IN {3, 4, 5, 7, 8, 9, 13, 18}' the whole expression runs ok.
So there is still some problem with IN statement.

Any help will be appreciated.
0 Kudos
MarcinGasior
Regular Contributor
I think, I've found the problem.
The list should be in parentheses: '... IN ({3, 4, 5, 7, 8, 9, 13, 18}) ...'

It seems to be undocummented behavior, isn't it.
0 Kudos