Remove overlapping cells between two grids

528
5
06-03-2012 06:47 PM
MichaelJust
New Contributor
Hello,
For example, I have two grids (A and B). I would like to remove from GridA any cells that have a value in GridB.  Grids A and B occupy the same space but measure different things.  What is the best way to perform this operation?  I was not having success googling the issue.

Thank you kindly,
Mike
0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus
You could do this with Con or SetNull depending upon what you want.  Both are documented in SA's help file.
0 Kudos
MichaelJust
New Contributor
You could do this with Con or SetNull depending upon what you want.  Both are documented in SA's help file.


Con ("Grid B" < 0, 0, "Grid A"): This means where Grid B is less than zero use zero, otherwise use Grid A. But this would require an additional step of making the values "null".

So, can I use two "InGrids" with SetNull?  For example, SetNull("Grid B", "Grid A").  Would this equate as set null all values of Grid B and use only non-overlapping values of Grid A.

Thanks again,
Cheers,
Mike
0 Kudos
DanPatterson_Retired
MVP Emeritus
In SetNull you can apply a condition, if it is true, then it will be null otherwise, you can specify what you want it to be
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//009z00000007000000.htm
0 Kudos
MichaelJust
New Contributor
Thank you both:
"!IsNull" is new to me, specifically the "!"

Cheers,
Mike
0 Kudos
curtvprice
MVP Esteemed Contributor
Just to point out there is no one answer to your question, and how Map Algebra is used is often a choice of style...

  • I prefer using the "not" operator.

  • You can also use the output of IsNull explicitly, as it returns 1/0 (true/false) values.

  • I'm a big fan of the Con tool because it is so flexible, especially when combined with IsNull.  (In the expression below, if you leave off the third argument, any cell evaluating to False returns NoData in the output.)

So, these expressions are all equivalent:
SetNull(not IsNull("B"), "A")
SetNull(IsNull("B") == 0,"A")
Con(IsNull("B"),"A")
0 Kudos