About Group-Based Transformers
A Group-Based Transformer processes a number of features simultaneously, or in a group. In most cases, the features are processed against each other; for example a PointOnAreaOverlayer. The act of processing in this way is known as Group-Based Processing. In general, most transformers dealing with spatial data are group-based, while attribute handling transformers are mostly Feature-Based Transformers.
Some examples of Group-Based restructuring are:
- Polygon Creation – FME can create polygon features from a set of line features when they form a closed shape. The line features are grouped together to produce a single area feature.
- Statistics Calculation – the StatisticsCalculator transformer calculates the mean, maximum and minimum values of an attribute for a whole group of features.
- Intersections – calculating the intersection points of a set of lines falls under group-based restructuring because each input feature in the group affects the output.
Grouping Behavior (Group By Parameter)
The default behavior for a group-based transformer is to use the entire set of features as the group. For example, an AreaBuilder transformer will attempt to build area features out of all of the features that enter.
However, most group-based transformers have a Group By parameter. This parameter allows you to select an attribute on which groups are to be formed. For example, an Intersector with the Group By parameter set to "road_type" will only intersect features whose value for the attribute "road_type" is a match.
It's somewhat difficult to categorize some transformers as being group-based transformers. The usual definition is that a number of features are processed against each other, and each feature can in some way affect the processing of the others. But this definition becomes blurred for, say, raster transformers (technically each raster is a separate feature in itself, not each cell) and for transformers such as the Snapper (where features are processed in a group, but have no effect on each other's processing).
A feature of group-based transformers is that they go against the general rule of FME, that features are processed one at a time, and require that a number of features be held in memory at one time. Because of this, such transformers are more prone to consume large amounts of system resources (some such as the Clipper have extra options to help mitigate this effect) but can be used creatively to handle the flow of features through a workspace.
Output and Output Attributes
Although all group-based transformers process features one against the other, there is a difference in the type of output returned. Some transformers output all the original features, but slightly transformed in some way – the NeighborFinder, Snapper, and Sorter are good examples of this. However, some transformers actually combine the original features together to form a new output – the PolygonBuilder, TINGenerator and Clipper are good examples of this. When the output is a combination of several different features, most transformers will remove source attributes, the reason being there is no way of knowing which of the source attribute values should be applied when there are a number of features. The two exceptions are:
- Using a Group By: When you do this, the Group By attributes are generally passed on to the output feature, since by definition all the source values will be the same (that's how the group is formed).
- Using a list: Many transformers have a list option so you can keep track of source attributes by keeping all the values.