Description
This tool generalizes / simplifies a thematic (categorical) raster dataset by recoding the smallest contiguous groups of pixels of the same value with the pixel value of the largest neighbouring group. You must run the regiongroup command before running this command as the output of the regiongroup command serves as the input to this command.
The cell neighbourhood that is evaluated can be all eight cells that surround a cell (this is the default option), or can be limited to only the four cardinal cells using the 'diag=FALSE' option, which prevents diagonal connections being evaluated when defining region membership. You will probably want to use use the same option here that was used with the regiongroup command.
This is an iterative command whereby the maximum allowed number of iterations is controlled by the limit option. If your raster is simple (relatively homogeneous) then only one or two iterations may be required. However, If portions of the raster are highly heterogeneous, and many small groups of pixels are mixed together, then more iterations will be required to arrive at a solution that no longer changes. As a general rule, 20 iterations is a reasonable starting point, but it is recommended that you inspect the raster to ensure the command has produced consistent results. Watch the number of groups to classify decrease in the progress bar as it processes. If it reaches 0 then it has reached an endpoint that cannot be further improved.
Syntax
generalizeregions(in, table, limit, out, [diag]);
| in | the input raster region data source | |
| table | the input table data source resulting from the regiongroup command | |
| limit | the minimum region size expressed as the minimum number of raster pixels | |
| out | the output raster data source | |
| [diag] | (TRUE/FALSE) allow cells to be diagonally connected when generalizing regions? (default=TRUE) |
Example
generalizeregions(in="C:\data\lcovregions.img", table="C:\data\lcovregions.dbf", limit=10, out="C:\data\lcovgen");
generalizeregions(in="C:\data\lcovrg", table="C:\data\lcovrg.dbf", limit=20, out="C:\data\lcovgeneralized.tif", diag=FALSE);