Iteration

Functionality

Iterations are a special type of map calculations. They are a successive repetition of a mathematical operation, using the result of one calculation as input for the next. These calculations are performed line by line, pixel by pixel and take place in all directions. When a calculation in one direction is finished (for instance from top to bottom) a rotation takes place for the calculation in the next direction.

The calculation stops when the difference of the output compared to the input is negligible or if the number of steps is reached which was defined before. Iterations are often used in combination with neighbourhood operations. Such an application might be for instance the selection of an item or area which fits a certain condition, starting from one pixel. For more information, see Map Calculation : neighbourhood operations; an example is presented in topic How to calculate flooded area and water volume after constructing a dam.

In ILWIS, four iteration operations are available listed below:

MAPITER(startmap, iterexpr)

performs iterations on the startmap according the iteration expression until no pixel changes anymore;

MAPITER(startmap, iterexpr, nr of iterations)

performs a specified number of iterations on the startmap according the iteration expression;

MAPITERPROP(startmap, iterexpr)

performs iterations with propagation on a startmap until no pixel changes anymore; the newly calculated value for a pixel is used in calculating the next pixel instead of in the next iteration;

MAPITERPROP(startmap, iterexpr, nr of iterations)

performs a specified number of iterations with propagation on a startmap; the newly calculated value for a pixel is used in calculating the next pixel instead of in the next iteration.

The input map for an iteration is called a start map and contains one or more pixels which act as the starting point of the calculation.The iteration expression defines a certain condition or defines a calculation to be performed.

After each iteration ILWIS shows the number of changed pixels.

Input map requirements:

The start map should contain one or more starting pixels. The other pixels should not be undefined because then every calculation will result into another undefined, unless you use the IFUNDEF or IFF combined with ISUNDEF (see also Map and Table Calculation : Functional overview of operators and functions).

Domain and georeference of output map:

The output raster map will generally use the system domain Value. The output map uses the georeference of the input raster map.

See also: