Moving average

Algorithm

Moving average performs a weighted averaging on point values and returns a raster map as output. The user has to specify a weight function and a limiting distance.

  

  1. First, for each output pixel, the distances of all points towards the output pixel are calculated to determine weight factors for the points:
  2.   

    For each output pixel, weight factors for the points are then calculated according to the weight function specified by the user. Two weight functions are available: inverse distance and linear decrease.

      

    Inverse distance:

    weight = (1 / dn ) - 1

    Linear decrease:

    weight = 1 - dn

      

    where:

    d

    =

    D/D0 = relative distance of point to output pixel

    D

    =

    Euclidean distance of point to output pixel

    When the spherical distance option is used, distances (D) are calculated over the sphere using the projection of the coordinate system that is used by the georeference of the output raster map.

    D0

    =

    limiting distance

    n

    =

    weight exponent

      

    Figures 1 and 2 below show the manner in which weight values decrease with increasing distance, for different values of n. The X-axes represent d: the distance of a point towards an output pixel divided by the limiting distance. The Y-axes represent the calculated weight values.

      

    Fig. 1: Inverse distance
    weight = (1/dn ) - 1
    X-axis: d = D/D0
    Y-axis: weight values

    Fig. 2: Linear decrease
    weight = 1 - dn
    X-axis: d = D/D0
    Y-axis: weight values

      

    The weight functions ensure that points close to an output pixel obtain a larger weight value than points which are farther away from an output pixel.

      

    See that when the distance of a point towards an output pixel equals the limiting distance (value 1.0 at X-axis), or when the distance of a point towards an output pixel is larger than the limiting distance, the calculated weight value will equal 0; the weight functions are thus continuous.

    Tips:

      

  3. Then, for each output pixel, an output value is calculated as the sum of the products of calculated weight values and point values, divided by sum of weights.
  4.   

    output pixel value

    =

    S ( w i * val i ) / S w i

      

    where:

    w i

    =

    weight value for point i

    val i

    =

    point value of point i

Tip:

For time efficiency reasons, it is strongly advised to choose a rather large pixel size for the output raster map. Further interpolation on the raster values can be performed with the Densify operation or the Resample operation (using bilinear or bicubic interpolation).

See also: