Operations: Binary logical raster

From ILWIS
Revision as of 12:02, 10 April 2017 by Jamshid (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main Page Arrow.png Operations
Binary logical raster
Binary logical raster

Binary logical raster operation is used to generate boolean maps based on logical and relational operators. The operation includes operators such as: and, or, xor(exclusive or), less, lesseq(equal or less than), neq (not equal), eq (equal), greater and greatereq(equal or greater than). One of the input map for this operation has to be a boolean map or a number. The output map is a Boolean map with value 1 (True) and 0 (False) illustrating whether the condition is met or not, respectively.

The Binary logical raster 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 input raster coverage or number, name of input raster coverage or number, Operator)


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


output raster = ilwis.Engine.do("binarylogicalraster", “file:///C:/my director/my raster coverage/number", “file:///C:/my director/my raster coverage/number", "Operator")
Note that, one of the input has to be a number or a Boolean map.


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:


rc = ilwis.RasterCoverage("file:///C:/my director/ myfile.mpr")

rcb = ilwis.RasterCoverage("file:///C:/my director/ myfile-boolean.mpr")

Note that, this file is a Boolean map.


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("binarylogicalraster", rc, "rcb" "greater")

Figure 1, Binary logical raster operation form


To start the Binary logical raster operation from ILWIS main window:

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

Once the Binary logical raster 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), Operators, 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. Note that, one of the input has to be either a Boolean map or a number.

input raster coverage or number/boolean: Select an input raster coverage.
input raster coverage or number/boolean: Select the second raster input. Note, one of the input has to be a Boolean map or a number.
Operator: Select an operator from the list.
output raster coverage: Type a name for the output Boolean raster map.
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.