Geospatial Modelling Environment

generalizeregions (Generalize Raster Regions)

Generalizes / simplifies a thematic raster dataset based on the size of groups of contiguous pixels of the same value


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.


generalizeregions(in, table, limit, out, [diag]);

inthe input raster region data source
tablethe input table data source resulting from the regiongroup command
limitthe minimum region size expressed as the minimum number of connected raster pixels
outthe output raster data source
[diag](TRUE/FALSE) allow cells to be diagonally connected when generalizing regions? (default=TRUE)


generalizeregions(in=”C:datalcovregions.img”, table=”C:datalcovregions.dbf”, limit=10, out=”C:datalcovgen”);

generalizeregions(in=”C:datalcovrg”, table=”C:datalcovrg.dbf”, limit=20, out=”C:datalcovgeneralized.tif”, diag=FALSE);


Please consider making a purchase to support the continued development of these tools  Read more...

Tips on how to use this interface efficiently 


Open Source GIS

Copyright © 2001-2014 Hawthorne L. Beyer, Ph.D., Spatial Ecology LLC    Connect on LinkedIn