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 (the default setting), 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
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:
|
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. This parameter applies to attributes as well as geometry traits. |
Lenient Geometry Matching |
If Yes, then the order of points in line and area features will be ignored. Composition differences between paths and lines will be ignored. True arcs and ellipses versus their stroked polygon equivalents will be ignored in Aggregates, Polygons, Donuts, Paths, and all other multis. When comparing raster geometries, only the extents are compared. |
Interior Vertex Tolerance | This parameter determines how close together interior vertices must be in order for them to be declared a match. Note that the start and end points of features should be LESS than the parameter value. That is, if two vertices are 2 meters apart, and the parameter is set to 2, they will not match. This value is optional. |
Extra Vertex Tolerance | When geometry is being matched, Extra Vertex Tolerance can allow for extra vertices along line segments. A value of 0 means that no such extra vertices are permitted. A nonzero value controls how close any extra vertices must be to the line connecting the adjoining matching vertices. |
Note: For surface and solid geometries, Interior Vertex Tolerance and Extra Vertex Tolerance are ignored and assumed to be 0.0. This transformer does not support surfaces or solids in the input if the Lenient Geometry Matching is set to Yes.
Match ID Output 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 Output | 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. All list attribute transformers are displayed in the Contents pane of the Transformer Help under Lists. 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 - whether entered directly in a parameter or constructed using one of the editors.
These functions manipulate and format strings. | |
A set of control characters is available in the Text Editor. | |
Math functions are available in both editors. | |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
Working with 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 Knowledge Center
The FME Knowledge Center 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 Knowledge Center.
Examples may contain information licensed under the Open Government Licence – Vancouver