|Exercise 2c||Flood Risk Project: Conditional Values Method|
This is a one-step process involving an AttributeManager transformer.
1) Place AttributeManager
Place an AttributeManager transformer and connect it to the AttributeRenamer:
2) Set First AttributeManager Condition
Inspect the parameters either in the parameters dialog or the Parameter Editor window. Ignoring all of the existing attributes, scroll to the bottom of the dialog and in the <Add New Attribute> field enter FloodRisk.
In the Attribute Value field click the drop-down arrow and choose Conditional Value:
This opens a new dialog very similar to a Tester/TestFilter transformer. There are fields for Test Condition and Output Value. Double-click the first Test Condition field and a Tester-like dialog will open:
This can be the test for FloodRisk=1 (the highest). According to the table of calculations, this can occur only when Zone=100 and Elevation <= 10. So, set up the conditions to test for Zone = 100 AND Elevation <= 10. The important part here is to set up the test as an AND (i.e. both clauses) must be true.
Enter 1 into the Attribute Value parameter at the foot of the dialog:
Now click OK to close this part of the dialog.
The main Conditional Definition dialog now looks like this:
3) Set Second AttributeManager Condition
Now double-click the next Test Condition (Else If) to set up the condition for FloodRisk=2
According to the table, there are two conditions for FloodRisk=2. They are when:
- Zone = 200 AND Elevation <= 10
- Zone = 100 AND Elevation <= 25
So, enter four clauses; one each for Zone=100, Zone=200, Elevation<=10, Elevation<=25.
Also, change the test type to Composite. In the Composite Expression field, enter:
- (1 AND 4) OR (2 AND 3)
Of course, the composite expression field depends on the order in which you entered the clauses. If you entered them in a different order, then you will need to adjust this field.
Enter 2 into the Attribute Value parameter and click OK to close this dialog. The main Conditional Definition dialog now looks like this:
4) Set Remaining TestFilter Conditions
Now repeat the above steps for each of the other flood risk values. There will be five conditions in all (one for each flood risk).
It may seem complicated, but it should be easy to get into a routine. Additionally, make use of the Copy and Paste buttons or keyboard shortcuts in these dialogs to speed up the process.
The final dialog will look like this:
It is essential to keep these in the correct order; otherwise, a feature may pass the tests in the wrong order and receive a lesser risk than expected.
Accept the changes and the main AttributeManager dialog now looks like this:
5) Add Inspector
Inspecting cached data doesn't allow you to separate that data out for easier inspection. So place a single Inspector transformer and connect each AttributeRangeMapper output to it.
Open the Inspector parameters dialog and under Group-By select the newly created attribute called FloodRisk.
|To achieve the same effect with Feature Caching, add a second AttributeFilter and filter by FloodRisk. Set the filters to 1,2,3,4,5. Then run the workspace, select the transformer, and press Ctrl+I to inspect it.|
6) Save and Run Workspace
Save and run the workspace. You should see each address colored to match its flood risk. You can also turn off each zone, in turn, to see which addresses are most/least at risk.
By completing this exercise you have learned how to: