how can I eliminate "island" raster cells from a layer?

2630
6
02-19-2013 05:29 PM
StephanieWeigel1
New Contributor
I want to clean up a raster layer by generalizing in a way that any "island" cells are eliminated.  There are only 2 values in the layer, 0 and 6.  So, for any cell that is currently of value 6 that is surrounded by all 8 cells with a value of 0, I want to change the "island" cell from a 6 to a zero.  

There must be a way to do this, but I am new to using raster analysis in arcgis and have tried everything I can think of.

Thanks for any ideas.
Stephanie
0 Kudos
6 Replies
DanPatterson_Retired
MVP Emeritus
There are a variety of methods but have you ruled out using a majority reclassify filter?
0 Kudos
StephanieWeigel1
New Contributor
I tried the Generalization--Majority Filter in the toolbox in all combinations but that didn't do it. I"m not sure that is what you are suggesting.  I apologize for not being up to speed on all the terminology so appreciate any explicit instructions.  I understand the concepts but am weak on the tools available.

thanks
STephanie
0 Kudos
MarkBoucher
Occasional Contributor III
You could do it "the hard way". I commented on another thread where the user wanted to analyze the values around a grid cell. I found the "Shift" tool. http://forums.arcgis.com/threads/75804-surface-angle-in-each-cardinal-direction?p=265962&viewfull=1#...

Later I used this myself for all 8 directions to make temporary grids for each of the 8 directions. Each shift is to one of the eight directions. My grid dimension is 10, so I have (10,10) (10,0) (10,-10), (0,-10), (0,10) (-10,10) (-10,0) (-10,-10). Then I used different tools to get the results I wanted.

You could do the same. If you use Cell Statistics tool with the choice of "Max" of the eight rasters, any place where the max is 0 and the original grid is 6 you should make the results 0.  Otherwise the value should be the same as the original. You can use
the Con() function for making this decision.

I did my work in model builder and below is an image of my modified model for your situation.

[ATTACH=CONFIG]21989[/ATTACH]

0 Kudos
StephanieWeigel1
New Contributor
I'm following the concept -- let me see if I can get the Shift idea to work. Thanks for the suggestion.
0 Kudos
StephanieWeigel1
New Contributor
Well, I used another blunt instrument in the end -- Focal statistics with an irregular neighborhood that summed all of the values surrounding the islands (which were 0s) but did not include the island itself. Then I extracted using masks to get rid of the islands based on the results of the focal statistics.

not elegant but it worked in the end.  I think I could have eliminated a few steps but am unfamiliar with the tools and couldn't find the ones I needed for a more efficient overlay.

thanks for the ideas.

Stephanie
0 Kudos
curtvprice
MVP Esteemed Contributor
I think the tool you were looking for was Nibble. I think of it as the raster equivalent of the Eliminate tool.

You can use Region Group and Zonal Geometry to find the area of each clump of contiguous values, then use Set Null to mark the areas you want to remove as NoData, followed by Nibble to fill them in with nearby values.
0 Kudos