In this example, a simple workflow is designed and constructed for resampling raster maps, when their pixel size are different, to a desired pixel size. The goal is to demonstrate how to use a condition box (if, then, else) in a workflow which allow you to compere property or compatibility of two ILWIS objects. In this example, the workflow task is to compare the pixel size of the input raster map with the given value of e.g. 250 m. If the input pixel size unequal to 250 meter, then the input raster map will be resampled using a given georeference with 250 meter pixel size and afterward the final output will be saved. If the pixel size of the input raster map is already 250 meter, it wont be resampled, but as an output will be directly send to save as operation to be saved. This due to the fact that a condition box has to have an output to satisfy the else condition.
Figure 1, a condition box used within workflow.
To construct aforementioned workflow, we used number of operations namely: connect, property, compare, resample raster and save as and a condition box (Figure 1) which have if, then, else construction. Each of these operation is illustrated as a box in the workflow. As it can be seen in Figure 1, the condition box consists of the flowing:
- Test field; allows user to drop any operation that generate a Boolean output. It uses a Boolean expression and a Boolean domain to returns True or False value. For example, the operation compare generate either True or False output allowing a comparison to be tested. ILWIS allows several number of operation to be added in the Test field.
- Logical connectors; the available logical connectors (and, or, not) can be used to establish relation between the Test field operations. For example, when a and b are Boolean expression:
- the logical connector AND returns True if a and b are true (a AND b)
- The logical connector OR returns True if either a or b is true, or if both a and b are true(a OR b)
- The logical connector NOT returns True if a is false and inverse (NOT a).
- The Zoom button in the Test field is used to visualize details of the dropped in operations.
- The Operation area is used to include the operation that has to be implemented if the condition is met.
- The Button bar is used to create a junctions.
- The Junction task is to look after the inputs and output. It receive two inputs one is the output of the operation in the condition box and one directly (the same input that goes to the operation in the condition box). It will pass one of the output, depending on the outcome of the Test field, to the next operation that happens outside of the condition box.
The following steps allows you to create and build this example (Figure 2):
- From ILWIS main window, click Create tab
- From the opened Object Creation form, select Workflow
- Type a name for the workflow in the corresponding field of the opened workflow form
- You may add Keywords and Description in their corresponding location in the form; it is optional
- Click Create & Open button once you are ready with the form;
Figure 2, a workflow to resample raster maps to desired georeference.
This will generate an empty workflow and open the workflow builder panel as illustrated in Figure 2.
To add the required input data and operations to the workflow panel:
- From ILWIS main window, click Operation tab or operation catalog tab
- From the operation list, drag the connect operation and drop it in the workflow editor
- From the operation list, drag the Property operation and drop it in the workflow editor
- From the operation list, drag the saveas operation and drop it in the workflow editor
- From the workflow Button bar click the add condition tab and then place the mouse pointer within the workflow editor to and a condition box
- From the Condition Button bar click add junction button to add a junction to the condition box.
- From the operation list, drag the Compare operation and drop it in the Test field
- From the operation list, drag the Resample rasters operation and drop it in the condition box
You may add metadata and customize the contents and title of each added box in the workflow editor; the details are explained in Create workflow.
Follow the steps bellow to specify the fixed parameters for number of the added operation to the workflow editor:
- Select one of the box in the workflow editor; e.g., Property
- Click Selected operation tab from the Action panel tab
- The opened Selected operation form allows you to select a property from the dropdown list. Click, on the field Requested property value and select xsize
- Click the Set fixed parameters button to set the xsize property as a fixed parameter. If it done correctly the color of the text (1: Requested property value) in the property box will change to green.
- Select another box in the workflow editor; e.g., Resample raster
- Drop a desired georeference to the field of target georeference, select a resampling method e.g., nearest neighbour and click the Set fixed parameters button. If it done correctly the color of the text (1: target georeference and 2: Resampling method) in the resample box will change to green.
- Select the saveas box in the workflow editor
- Enter a location, where the file will be saved, in the field Output url; input a format for the file e.g., map, in the field Format; type name of the provider in the field Provider, in this case map. Click the Set fixed parameters button; if it done correctly the color of the text (1: Output url,2: Format, and 3: Provider) in the saveas box will change to green.
In order to define the execution procedures you need to connect and define the input and output for each box. Note once the box is selected, 8 tiny handles (connectors) will appear around the selected box. You can use any of them to connect the box to another one by dragging an arrow form it using the mouse. By pointing the mouse pointer at one of the connectors, it color changes to red and an arrow will appear at the tip of the mouse pointer which can be dragged (extend) by moving the mouse. At the same time, the connectors around all the other boxes will be available and thus you are able to connect to any one of them and specify the inputs parameters for that box. It has to be mentioned that each box (or operation) in workflow generate one output which can be used as an input parameter for another operation.
To define the execution procedure for the workflow, follow the steps below(Figure 2):
- Select the Connect box and connect it to property box, resample box and the junction as it shown in Fig 2.
- Connect the resample box to junction
- Connect the junction to saveas box
- Click the zoom button on the Test field to display the detail of the compare box. as it can be seen, the compare box has 3 fields:
- 0: first value
- 1: operator
- 2: second value
- Connect the property box to the first value field; type > in the field operator; type 250 in the field second value and click the zoom button again to close the displayed details.
If everything is done correctly, the color of condition box will change from red to blue meaning the workflow is ready and has to be saved by using the save button; the first one on the button bar. Now you can run the workflow directly using the Run form. The run form allow you to add the required input parameters by drag and drop action. Once you are ready with the Run form:
- Click the Run on the Action button bar to run the workflow in one go
- Click the Stop button to stop the workflow of being executed. Note, using the Stop button will completely stop the workflow.
- Click the Run in step mode button to run the workflow one step at the time. The output result after each step will be displayed in the Step form and can be visualized by being double clicked. Note, once the workflow is saved, it will be available in the ILWIS operation list and therefore it can be executed as an operation.