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.