The Flow of Features in FME Translations

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

There are precise rules that dictate how features flow through an FME workspace, and knowing these rules helps a workspace author in more advanced projects.

 

This workspace is a simple one that reads a dataset of people (in Shape format), filters out males, measures female height, and writes the results back to another dataset (again in Shape format):

core-flow-workspace.png

NB: The Junction transformer exists only to help demonstrate the relevant events in the translation

This workspace can be used to demonstrate how features pass through a workspace. To do so, carry out the following actions.

 

Step-by-step Instructions

1) Open the workspace (or template). Right-click on the connection between the reader feature type People and the Junction transformer. Choose the option to Add Breakpoint:

6143-core-flow-breakpoint.png

2) Select Run > Run with breakpoints from the menubar:

core-flow-runwithbreakpoint.png

...and run the workspace. Notice that a single feature is read from the source data and pauses the translation at the breakpoint. A dialog opens to inspect the feature:

core-flow-malefeature.png

Notice that the Gender field is M (male).

 

3) Click the “Step to next connection” button on the Feature Inspector window. This moves the feature on to the next connection (Junction -> Tester). The red line denotes this.

core-flow-redline.png

 

Lesson: This is an important part of FME processing. FME does not carry out one process at a time (for example, read all of the data at once) instead it reads one feature at a time and processes that feature through the entire workspace.

 

4) Click the “Step to next connection” button one more time. The feature disappears and a second one appears between the People feature type and Junction transformer.

 

Lesson: The first feature disappeared because it failed the Tester test, which is looking for Gender=F. This shows that because the Failed port is unconnected, the feature is simply discarded from our translation.

 

5) Click the “Step to next connection” button two more times. Now we have another new feature that has been read. This time the Gender attribute is F so this will pass the Tester. Click the “Step to next connection” button two more times and this feature will emerge from the Tester:Passed port. Click the button one more time and the feature will emerge from the LengthCalculator:Output port:

core-flow-lengthcalc.png

Notice that it now has a Height attribute.

 

Lesson: This is why the FME log window can be a little confusing. The processing order is not Reader-Transformer-Transformer-Writer, it is feature 1, feature 2, feature 3; so the order of the log messages can sometimes appear as if it is out of sequence.

 

6) Click the “Step to next connection” button one more time. The feature is sent to the Writer, which is only now activated. Notice that the log window shows that a Shapefile writer has been created (Creating writer for format: Esri Shapefile, Opened Shape File 'C:\FMEData2017\Output\Training\People.shp' for output)

core-flow-writerlog.png

 

Lesson: This is why FME translations generally shouldn’t write back to the same dataset that they are reading from. In this case we are writing data before reading has been completed. If you tried to write back to the same dataset then we would be reading and writing data to the same file simultaneously!

 

7) Keep clicking the “Step to next connection” button, advancing features through the workspace, until you fully understand what is happening. Then click the “Continue translation” button to run the workspace without stopping at any more breakpoints.

 

Lesson: One final lesson is that features are written one at a time. The Writer does not store up data and write it in a block.

 

 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.