Operations: Cross

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

The Cross operation performs an overlay of two raster maps: pixels on the same positions in both maps are compared; the occurring combinations of class names, identifiers or values of pixels in the first input map and those of pixels in the second input map are stored. These combinations give an output cross map and a cross table. The cross table includes the combinations of input values, classes or IDs, the number of pixels that occur for each combination and the area for each combination. To execute the operation, it is required that both input maps use the same georeference. The output of the cross operation are a map, a table and an identifier domain which is used by the output map and table. The output map will have the same gereference as the input map. The output domain obtains the same name as the output map and includes all combinations of class names, IDs or values or colors of both input maps.
The Cross 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 first input raster coverage, name of the second raster coverage, name of the method for handling undefined values, defining whether the output coverage has to be generated)

Then, the Python syntax for the above mentioned operation is:


cross raster/table=ilwis.Engine.do('cross', “file:///C:/my director/first raster", “file:///C:/my director/second raster", "undef hadling Method", Generate raster)


In general, the URL used in the Python syntax can be replaced with variable name created via using Python. For example: you can open two raster coverage's as variables and give them names as the following example:


rc1 = ilwis.RasterCoverage("file:///C:/my director/first raster.mpr")
rc2 = ilwis.RasterCoverage("file:///C:/my director/second raster.mpr")

Once the variables is created via ILWIS-Python editor, then it can be used directly in Python syntax without quotation mark and the path as the following:


cross raster = ilwis.Engine.do( "cross", rc1 , rc2, "ignoreundef", True)

Where ignoreundef refers to ignore all the undefined values and True refers to generate a raster coverage output.

Figure 1, Cross operation form


To start the Cross operation from ILWIS main window:

Mar.jpg
  • Click the Operation tab on toolbar tabs
  • From the opened operation list select Cross

Once the Cross operation is selected from the list, an operation form will be opened in which you can set parameters required for the 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.

First raster coverage: Enter an input raster coverage; use drag and drop.
Second raster coverage: Enter an input raster coverage; use drag and drop.
Undef handling: choose one of the available methods to handle undefined values in the raster map. Selecting the firs option ignoreundef, all the undefined values in both raster maps will be excluded. The options ignoreundef1 and ignoreundef2 refers to exclude undefined values in first and second raster coverage respectively. The option dontcare suggests that the udefined values will be included.
Generate raster: When selecting Yes an output raster map will be generated. The operation will create a cross table and a cross raster coverage. By selecting No the output of cross operation will be a cross table.
Output table: Type a name for the output cross table.
Output format: Select a format from the list 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.
Output raster: Type a name for the output cross raster coverage.
Output format: Select a format from the list 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.