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.
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.
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).
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
Features for matching. All features are compared to all other features.
Output Ports
All features matching another feature are output to the Matched port.
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.
All non-matching features are sent to the NotMatched port.
Parameters
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. |
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. |
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. 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). 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.
Match ID Attribute | 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 (SingleMatched Only)
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 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
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, click beside the applicable parameter. For more information, see Transformer Parameter Menu Options.
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. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
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.
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. |
Reference
Processing Behavior |
|
Feature Holding |
Yes |
Dependencies | None |
FME Licensing Level | FME Base Edition and above |
Aliases | |
History |
|
Categories |
FME Community
The FME Community is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for all results about the Matcher on the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver