3

I want to run the majority filter in ArcGIS Desktop with a window size of 4 or 5 i.e. greater than the default 3.

Is it possible, or is there some other command (or tool) which might help me achieve that?

2 Answers 2

5

A Focal Majority function does a very poor job at establishing a MMU. I would recommend using a sieve approach. This will provide an exact defined MMU.

I believe that GDAL has a sieve model and it is also available in our Gradient Metrics ArcGIS Toolbox. It is an easy procedure to implement. The ArcGIS steps for using sieve to establish a minimal mapping unit of 10 cells are, more or less, as follows:

MinCells = 10
tmp1 = RegionGroup(InRaster, "EIGHT", "WITHIN", "ADD_LINK", "") 
  query = "VALUE > " + minCells
tmp2 = ExtractByAttributes(tmp1, query)
outraster = Nibble(InRaster, tmp2)
3
  • Thanks Jeffrey, I will test out both approaches (Focal Vs Gradient Metrics toolkit) and check out the differences in my area.
    – user1186
    Mar 7, 2013 at 17:55
  • You were right, the sieve tool provides much better results! Thanks for the excellent toolkit. Just one query, the 'minimum cells in mapping unit' parameter in the sieve tool defines the height/width of a square window, right?
    – user1186
    Mar 25, 2013 at 7:31
  • see gis.stackexchange.com/questions/97728/… for another downside of focal statistics Majority. You may end up with NoData pixels.
    – messamat
    May 27, 2020 at 16:13
5

Try using the Focal Statistics tool with a Majority rule. It allows you to set a variety of window shapes, sizes, etc.

1
  • 1
    Focal Statistics is quite universal - for example I needed the same as user1186 (larger kernel size than 3x3) and Focal Statistics with Mean rule was perfect. +1
    – Pavel V.
    Mar 7, 2013 at 14:03

Your Answer

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

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