I would like to use a nearest-neighbor type analysis to iterate over a raster. The nearest neighbor analysis will give a cell value of 1 IF AND ONLY IF the cell being analyzed has a cell value larger than all adjacent cells, and 0 otherwise. Is this type of analysis possible with Arcobjects or with the raster calculator tool using map algebra?
-
What software would you prefer to use? ArcGIS Spatial Analyst or ArcObjects? I would expect this to be easy with the Raster Calculator of Spatial Analyst so am wondering whether you have tried that without success.– PolyGeo ♦Commented Apr 26, 2013 at 23:33
-
1I am testing this statistical methodology as part of a raster extraction process for an automated ArcObjects implementation. I wanted to see if the statistical methodology provides the desired results without ArcObjects if possible first (it didn't unfortunately), so in this case Luke's ArcGIS Spatial Analyst implementation worked best for me. Thank you for your input.– ConorCommented Apr 27, 2013 at 0:55
Add a comment
|
1 Answer
Use the Con and FocalStatistics tools. Something like:
Con(inraster > FocalStatistics(inraster, NbrIrregular(kernel_file), "MAX", ""), 1, 0)
Where: kernel_file is a path to a text file that defines a neighbourhood that excludes the currently processed cell, something like:
3 3
1 1 1
1 0 1
1 1 1
You might also be able to do this with an annulus neighbourhood, but I can't test as I'm not at work.
-
1