Operations: Moving average

From ILWIS
Jump to: navigation, search
Main Page Arrow.png Operations
Moving average
Moving average

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)

Figure 1, Polygon to raster operation form



To start the Polygon to raster map operation from ILWIS main window:

Mar.jpg
  • Click the Operation tab on toolbar tabs
  • From the opened operation list select Polygon to raster map

Once the Polygon to raster map operation is selected from the list, an operation form will be opened in which you can set parameters required for that operation including input(s), output(s), memory location and data format (Figure 1).

To successfully execute this operation, you need to complete the form with proper inputs data. The inputs data must be dragged from the catalog and dropped in their corresponding fields in the form or typed in.

input feature coverage: Select an input feature coverage to be rasterized.
input georeference: Select an existing georeference for the output raster map(s) to which the input map(s) should be rasterized.
output raster coverage: Type a name for the output raster map that will contain rasterized pixels.
Output format: Select a format to save the output raster map. The default format is Memory; if you select it, the output will be temporally saved in the internal catalog and will be removed when you exit the program. If you select other format, the output will be saved in the active catalog.
Execute: Click the Execute button to run this operation.