I am currently working with some classified land cover rasters (containing 8 land cover classes) in ArcMap 10.0. I would like to make them look smoother and have therefore used the Focal Statistics Majority tool. This results in a raster which, at a first glance, looks great but when I look closer it is filled with thousands of NoData pixels at the boarders between the different land cover classes. I assume this happens because a cell will receive a NoData-value when there is more than one majority value within the neighbourhood. But I wonder if there is any way to avoid this by, for example, making it keep the original value instead of replacing it with NoData when it encounters the problem of having no majority value. Or is there any way to replace the NoData value with the original value after Focal Statistics? Or are there any other recognized, commonly used methods to replace missing data?
I would recommend using a sieve approach as an alternative to a majority filter. This will avoid the nodata issue and allow you to specify a minimal mapping unit (MMU). Here is a post that shows how to implement the methodology in ArcGIS.
Your observation is correct. As stated in the How Focal Statistics works help page under the
MAJORITY statistics type:
When there is more than one majority value within a neighborhood, the processing cell location will receive
NoDataon the output.
There is no way to force the Focal Stastics tool to keep the original value when there is a tie. However, there is a workaround to implement the same logic:
Run Focal Statistics using the
MAJORITYstatistics type as you've already done.
Run Raster Calculator with the expression:
Con(IsNull("filtered.tif"),"landcover.tif","filtered.tif"). In this example,
filtered.tifis your land cover data after performing the majority filter in Step 1, and
landcover.tifis your raw land cover data.
The raster calculator step above will replace any instances of
NoData in your majority filtered raster with the original values from your original land cover raster.