Moving average is a point interpolation which performs a weighted averaging on point values and returns a raster map as an output. The input map for this operation has to be a point map. For the point map with a non-value domain, an attribute table is required. The attribute table should have at least one column with value domain to be used for calculating weighted average. The output raster coverage uses the same value domain as the input attribute column, while the georeference of the output map has to be selected from one of existing georeference, or can be created by defining number of rows and columns.
The Moving average operation calculate values for the output pixels based on the weighted averages of input point values using the sum of the products of weights and point values, divided by the sum of weights. The operation form allows users to specify weight function, weight exponent and the limiting distance. The available weight function (Invers distance and Linear decrease) ensure that points which are close to an output pixel obtain large weights and that points which are farther away from an output pixel obtain small weights. Values of points which are close to an output pixel are thus of greater importance to this output pixel value than the values of points which are farther away. A limit distance value, define to which distance from any output pixel, points will be taken into account for the calculation. Meaning, for each output pixel, only the values of the points which fall within the limiting distance to this output pixel will be used. Values of points that are farther away from an output pixel than the specified limiting distance, will not be used in the output pixel value calculation.
The Moving average operation can be applied via ILWIS-Python editor or via ILWIS Main window, Toolbar and the Operatins tab. The required Python syntax is:
name of the output raster coverage = ilwis.Engine.do(name of the operation, name of the input feature coverage, name of the input column, weight function, weight exponent, Limiting distance, name of the target georeference or x size, input y size)
Then, the Python syntax for the above mentioned operation is:
output raster = ilwis.Engine.do("movingaverage", “file:///C:/my director/my feature coverage", "my column", "linear", weight exponent, Limiting distance, “file:///C:/mydirector/my georeference)
In general, the URL used in the Python syntax can be replaced with variable name created using Python. For example: you can open a feature coverage and a georeference as variables and give them a name as the following example:
fc = ilwis.FeatureCoverage("file:///C:/my director/ coverage.mpa")
georef = ilwis.GeoReference("file:///C:/my director/my georef.grf")
Note, in this example, the input map has a thematic domain and an attribute table with a column named "sand". Once the point map is opened in Python, the attribute table will be available, thus no need to be called. In case, the input map has a domain value, a column will be generated once it imported to the Python. By default, the name of the column is feature and this name can be used as the input column name in the syntax.
Once these variable is created via ILWIS-Python editor, then they can be used directly in Python syntax without quotation mark and the path as the following:
output = ilwis.Engine.do("movingaverage", fc, "sand" "linear", 1, 200, georef)