FME Transformers: 2024.2
FME Transformers: 2024.2
Matcher
Detects features that are matches of each other. Features are declared to match when they have matching geometry, matching attribute values, or both. A list of attributes which must differ between the features may also be specified.
Typical Uses
- Change detection
- Feature merging (data joins) based on geometry
How does it work?
The Matcher can receive any number of input feature streams. All features are compared against all other features, and matches are identified based on the parameters defined.
Options for matching include geometry and/or attributes, and you may also define attributes that must differ.
All features that find a match are output via the Matched port (that is, if two features match each other, both of them are output here). Each set of matches is given a new numeric Match ID attribute that can be used to identify them as a matching group.
A single copy of each set of matched features is sent to the SingleMatched port. The attributes on these features are merged on to one output feature. Using this port, the Matcher is capable of doing multi-feature merging using geometry as the key. This complements the FeatureMerger, which only accepts attributes, and not geometries, as keys.
Features that do not find a match are output via the NotMatched port.
Examples
Example: Change detection with the Matcher
In this example, we have two copies of a zoning dataset. One of them has been updated, with changes made to some zone attributes. The polygons do not have a unique ID that could be used to do a comparison to find the updated zones, so we need to use geometry matching.
Both the original and updated datasets are routed into a Matcher.
Match Geometry is set to 2D, and the Attribute Matching Strategy is Match Selected Attributes. We select ZoneCategory as the attribute to compare. This will find polygons that have matching geometry, and check whether or not the attribute has been changed.
One copy of the polygons that matched are output via the SingleMatched output port. These are the records that were not altered, shown below in blue.
Records that were altered would not encounter a match - though the geometry is the same, the attribute we specified is not. These features are output via the NotMatched port, shown here in red.
Usage Notes
- The ChangeDetector provides an alternative (but less general) approach which may be more convenient for certain applications.
- When looking for matches based only on attributes, consider the FeatureJoiner or FeatureMerger for better performance.
- Oriented points are supported, however, precision loss when converting between orientation representations will often cause the ChangeDetector and Matcher to identify two oriented points as Updated/NotMatched unless Lenient Geometry Matching is enabled.
Choosing a Feature Joining Method
Many transformers can perform data joining based on matching attributes, expressions and/or geometry. When choosing one for a specific joining task, considerations include the complexity of the join, data format, indexing, conflict handling, and desired results. Some transformers use SQL syntax, and some access external databases directly. They may or may not support list attribute reading and creation.
Generally, choosing the one that is most specific to the task you need to accomplish will provide the optimal performance results. If there is more than one way to do it (which is frequently the case), time spent on performance testing alternate methods may be worthwhile. Performance may vary greatly depending on the existence of key indexes when reading external tables (as opposed to features already in the workspace).
Joining Transformers Comparison
Transformer |
Match By |
Uses SQL Statements |
Can Create List |
Input Type |
Notable |
Description |
---|---|---|---|---|---|---|
FeatureJoiner | Attributes | No | No | Features |
|
Joins features by combining the attributes and/or geometry of features based on common key attribute values. Performs the equivalent of Inner, Left, and Full SQL joins. |
FeatureMerger | Attributes | No | Yes | Features |
|
Merges the attributes and/or geometry of one set of features onto another set of features, based on matching key attribute values and expressions. |
ListBasedFeatureMerger | List Attribute to Single Attribute | No | Yes | Features |
|
Merges the attributes and/or geometry of one set of features onto another set of features, based on matching list attribute values with key attribute values and expressions. |
InlineQuerier | SQL query | Yes | No | Features |
|
Creates a set of SQLite database tables from incoming features, executes SQL queries against them, and outputs the results as features. |
SQLCreator | SQL query | Yes | No | External DB |
|
Generates FME features from the results of a SQL query executed once against a database. One FME feature is created for each row of the results of the SQL query. |
SQLExecutor | SQL query | Yes | No | External DB |
|
Executes SQL queries against a database. One query is issued to the database for each initiating feature that enters the transformer. Both the initiating features and the results of the query may be output as features. |
DatabaseJoiner | Attributes | No | Yes | External DB and Features |
|
Joins attributes from an external table to features already in a workspace, based on a common key or keys. SQL knowledge not required. Non-blocking transformer. |
Matcher | Geometry and/or Attributes | No | Yes | Features |
|
Detects features that are matches of each other. Features are declared to match when they have matching geometry, matching attribute values, or both. A list of attributes which must differ between the features may also be specified. If matching on attributes only (not geometry), using the FeatureMerger or another method will give better performance. |
Configuration
Input Ports
Input
Features for matching. All features are compared to all other features.
Output Ports
Matched
All features matching another feature are output to the Matched port.
SingleMatched
A single copy of each set of matched features is sent to the SingleMatched port. The attributes on these features will be merged onto the single output feature.
NotMatched
All non-matching features are sent to the NotMatched port.
Parameters
Check Attributes
Attribute Matching Strategy |
In conjunction with Selected Attributes, this parameter controls which attributes of input features must have the same value before a match is declared.
|
Selected Attributes |
Applicable when Attribute Matching Strategy is set to Match Selected Attributes or Match All Except Selected Attributes, and specifies which attributes to match, or exclude from the match, depending on the matching strategy chosen. |
Attributes That Must Differ |
Controls which attributes that are part of the input feature must have different values before a match is declared. The values from all attributes matching the regular expression are concatenated together and compared to determine a match. |
Attribute Comparisons
Differentiate Empty, Missing, and Null Attributes |
No: Empty, missing, and null attributes will be treated as equivalent. Yes: Empty, missing, and null attributes will be considered as pairwise different. |
Check Attribute Types and Encodings |
No: Attributes with different types and encodings are considered a match if their value is the same Yes: Attributes must have the same type, encoding, and value to be considered a match. |
Check Geometry
Match Geometry |
Controls whether 2D or 3D (or no) geometry must be the same before a match is declared. FULL makes sure 3D, measures, and geometry traits all match. When comparing raster geometries:
When comparing surface and solid geometries: 2D behaves the same way as 3D, that is, Z values will also be compared. When comparing point cloud geometries:
|
Differentiate Empty, Missing, and Null Traits |
No: Empty, missing, and null traits (and names) will be treated as equivalent. Yes: Empty, missing, and null traits (and names) will be considered as pairwise different. |
Lenient Geometry Matching |
If Yes, then the order of points in line and area features will be ignored. Note that areas may have differing start/end vertex locations and still match if all coordinates fall within the Vector Tolerance distance (in ground units). For lines to match, however, including closed lines, they must have matching start and matching end vertices, within tolerance. Composition differences between paths, lines, and other curves will be ignored. The order of elements in collections, and the order of holes in Donuts will be ignored. When comparing raster geometries, only the extents are compared. |
Check Coordinate Systems |
No: The Coordinate Systems are ignored Yes: The name of the Coordinate System must be the same for both features |
Vector Tolerance |
Vector Tolerance allows two geometries to have spatial variation and still be considered a match. It only applies to vector based geometries (points, curves, areas). Provide a value in ground units. It is similar to a Fréchet distance: You have a dog leash of length “vector tolerance.” You will walk along the boundary of one of the geometries, your dog will walk along the boundary of the other. If you can both complete your walk without dropping the leash, the two geometries are within tolerance. This transformer has the added constraint for curves that you and your dog must both start at one end of your curve, and end at the other. |
Note For surface and solid geometries, Vector Tolerance is ignored and assumed to be 0.0.
Output Attribute Names
Match ID |
An ID is added to each set of matched features so that it is possible to build a relationship between them if required. |
Match Count Attribute on SingleMatched |
If provided, an attribute with this name will be added to each SingleMatched output, set to the number of contributing input features. |
Generate List
When enabled, adds a list attribute to each SingleMatched output feature, composed of attributes from all matching features.
Note List attributes are not accessible from the output schema in FME Workbench unless they are first processed using a transformer that operates on them, such as ListExploder or ListConcatenator. Alternatively, AttributeExposer can be used.
List Name on SingleMatched Output |
Enter a name for the list attribute. |
Add To List |
All Attributes: All attributes will be added to the output features. Selected Attributes: Enables the Selected Attributes parameter, where specific attributes may be chosen for inclusion. |
Selected Attributes |
Enabled when Add To List is set to Selected Attributes. Specify the attributes you wish to be included. |
Editing Transformer Parameters
Transformer parameters can be set by directly entering values, using expressions, or referencing other elements in the workspace such as attribute values or user parameters. Various editors and context menus are available to assist. To see what is available, click beside the applicable parameter.
How to Set Parameter Values
Defining Values
There are several ways to define a value for use in a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters.
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
Content Types
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
Math functions are available in both editors. | |
Date/Time Functions | Date and time functions are available in the Text Editor. |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Table Tools
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering
|
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste
|
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
Filter
|
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import
|
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
Reset/Refresh
|
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
Note: Not all tools are available in all transformers.
For more information, see Transformer Parameter Menu Options.
Reference
Processing Behavior |
|
Feature Holding |
Yes |
Dependencies | None |
Aliases | |
History |
|
FME Community
The FME Community has a wealth of FME knowledge with over 20,000 active members worldwide. Get help with FME, share knowledge, and connect with users globally.
Search for all results about the Matcher on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.