Separating Output Data with Fanout
A fanout is a way within FME to split output data based upon the value of an attribute. The data is divided at the time of writing, rather than within the workspace itself.
There are two kinds of fanout: feature type fanout and dataset fanout. You can set both a feature type fanout AND a dataset fanout in the same workspace. Dataset fanout produces a number of output datasets, each of which has a number of layers created by the feature type fanout.
You can set Dataset Fanout from the Navigator and you can set Feature Type Fanout from the Feature Type dialog.
A dataset fanout divides the data and writes a different dataset for each division. In this example, data is divided up into a number of datasets on the basis of an elevation attribute.
Feature Type Fanout
A feature type fanout writes a single dataset but divides the data into a number of layers/themes/feature types/objects/classes in that dataset. In this example, data is divided into a number of layers on the basis of an elevation attribute.
The difference between a dataset and feature type fanout is best explained through an example.
- A point dataset (for example, trees in a city)
- A polygon dataset (for example, a division of a city into neighborhoods)
The challenge is to produce a DXF file of the points, grouped into layers per neighborhood.
The polygons have an attribute containing the neighborhood code. After doing a simple PointOnAreaOverlayer, this attribute has been transferred to the points. On the output feature type, we've set the fanout based upon this attribute. This will group the points by neighborhood and create a separate layer for each group. This is a feature type fanout.
A second challenge is to produce one DXF file per neighborhood. After disabling the feature type fanout, we move to the dataset (in the workspace panel) and again use the neighborhood attribute. This then generates a separate DXF file per neighborhood. This is a dataset fanout.
File Versus Folder Datasets
The behavior of fanouts changes based on whether you are working with a file-based format or a folder-based format.
For instance, a DWG writer (file-based) creates new layers with a feature type fanout, and new drawings with a dataset fanout. A Microsoft Excel XLSXW2 writer (also file-based) creates new worksheets with a feature type fanout, and new .xls files with a dataset fanout.
An Esri Shapefile writer (folder-based) creates new shapefiles on a feature-type fanout, and new folders on a dataset fanout.
Each format in the FME Readers and Writers manual contains a Quick Facts table, which specifies the format's Dataset Type.
Each fanout setting only allows a user to select a single attribute to fan out by. However, multi-attribute fanouts can be created by merging attributes together using the StringConcatenator transformer.