Other Key Filter Transformers
The Tester and TestFilter are not the only useful filter transformers.
The AttributeFilter transformer (#13 in the top 30) directs features by values in a chosen attribute. It is not a binary test (Yes/No) but a way to separate many values for a single attribute, for example:
- Is that road an Arterial, Collector, NonCity, Other, Private, Residential, or Secondary?
If you were using seven Tester transformers to separate this data, you could save space on the workspace canvas and replace that setup with just a single AttributeFilter.
|Sister Intuitive says...|
|In almost every scenario where you are using multiple Tester transformers, it's possible to use a different filtering transformer to achieve the same result but using much less space on the canvas.|
The AttributeFilter also works with numeric values; however, its only "operator" is to find equivalency (=), so you would rarely use it for arithmetical tests. In that scenario, the better solution is the AttributeRangeFilter.
The AttributeRangeFilter carries out the same operation as the AttributeFilter, except that it can handle a range of numeric values instead of just a simple one-to-one match.
For example, we might want to separate data based on a range of snowfall values, like so:
Notice that the AttributeRangeFilter parameters dialog has a Generate button to generate ranges automatically from a set of user-defined extents.
The GeometryFilter (#22 in the top 30) directs features on the basis of geometry type; for example, point, line, area, ellipse:
It can even filter data based on null geometry (tabular records):
The GeometryFilter is useful for:
- Filtering out unwanted geometry types; for example, removing non-linear features before using an AreaBuilder transformer
- Validating geometry against a list of permitted types; for example, where the dataset is constrained to either point or area features (above)
- Dividing up geometry types to write to separate destination Feature Types; for example, when writing to a geometry-restricted format such as Esri Shapefile
|Confused from Interopolis says...|
Dear Aunt Interop,
If the Tester, TestFilter, and AttributeFilter all filter features on the basis of an attribute condition, then what’s the difference? When would I use each?
|Aunt Interop says...|
The best solution is to check out these two articles on the Safe Software blog:
- Conditional Processing in FME
- A Simple Guide to FME Filter Transformers
There's also a useful table I put together:
|Single Test||Multiple Tests||Test Type||Operators||Attributes|