small islands, how to eliminate?

Does anyone know a method to remove single pixel islands either in cell map or vector map
? I'm trying to export a grass file to arc.info and need fewer than 10,000
polygons for it to work.
Thanks,
Mary Ingham
mingham@grits.valdosta.peachnet.edu

Does anyone know a method to remove single pixel islands either in cell map
or vector map
? I'm trying to export a grass file to arc.info and need fewer than 10,000
polygons for it to work.
Thanks,
Mary Ingham
mingham@grits.valdosta.peachnet.edu

I been looking at this problems for some time. I presented some of my
results at the European Grass Users Conference this year.
Unfortunally I haven't had any time write it in a paper yet. But here
is the most simple solution. If you want to remove single pixel
islands you could remove those with a mode filter operation. Here is
one method to do this:

1. run r.clump and r.stats to detect which areas that only are on pixel islands
2 reclass all those areas to zero
3 run r.neighbors with the mode filter to fill those zero areas with the
   most frequent neighbors.

   You could also create a mask that protects all other areas to be
affected by the mode filter operation except for the zero holes. This
solution assumes that you have a map this is all non-zero values, otherwise
these have to be save with a reclass before you perform this operation.
  
If you want to do more advanced solutions I have a new mode
function that can be used in r.mapcalc if want to remove a slightly larger
pixel island. This gives an opportunity to create different shapes on
the mode filter kernel with the neighborhood facilities in r.mapcalc.

I don't remember but I think I sent this mode filter fuction to grassp once.

Good luck.

Lars

Lars Schylberg Email: larss@fmi.kth.se
Department of Photogrammetry
Royal Institute of Technology Tel. +46 8 790 86 33
S-100 44 STOCKHOLM, SWEDEN Fax. +46 8 790 66 10