Flood Risk Project: Complex Filtering Method
Start Workspace C:\FMEData2016\Workspaces\DesktopAdvanced\Attributes-Ex2-Begin.fmw
End Workspace C:\FMEData2016\Workspaces\DesktopAdvanced\Attributes-Ex2b-Complete.fmw

This slightly more complex method is also is a filtering process, but the filtering is all done in a single step - for both zones and elevation - with a TestFilter.

1) Place TestFilter
Place a TestFilter connected to the AttributeRenamer:

What we want to get here is a separate output port for each flood risk value. So we’ll need to incorporate all of the tests into this one transformer.

2) Set First TestFilter Condition
Open the parameters dialog. See that there are fields for Test Condition and Output Port. 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 Output Port parameter at the foot of the dialog:

Now click OK to close this part of the dialog.

The main TestFilter dialog now looks like this:

3) Set Second TestFilter Condition
Now double-click the next Test Condition 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.

Now 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 will depend on the order you entered the clauses in. If you entered them in a different order then you will need to adjust this field.

Enter 2 into the Output Port parameter and click OK to close this dialog. The main TestFilter 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 Duplicate buttons in these dialogs to speed up the process.

The final dialog will look like this:

The final test will be similar to the very first, with only two conditions, so it will be an AND rather than a Composite test.

It is very important to keep these in the correct order; otherwise a feature may pass the tests in the wrong order and be given a lesser risk than expected.

5) Add AttributeCreator
Add an AttributeCreator (or AttributeManager) connected to each TestFilter output port. Use the AttributeCreator to create the correct FloodRisk attribute (and value) for each output port (i.e. Port 1: FloodRisk = 1):

In fact, it’s probably easier to place one AttributeCreator and duplicate it for each port, editing the FloodRisk value each time.

6) Add Inspector
Place a single Inspector transformer and connect each AttributeCreator/Manager output to it. Open the Inspector parameters dialog and under Group-By select the newly created attribute called FloodRisk.

In 2016.1 the quickest way to do this is select all of the AttributeCreator/Manager transformers and then add an Inspector using Quick Add. This will automatically connect all five transformers and is a new piece of functionality for this version of FME. You'll still need to manually set the group-by setting on the Inspector.

7) 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:
  • Filter data with a complex test in order to subdivide it for attribute mapping

results matching ""

    No results matching ""