FeatureJoiner
Joins features by combining the attributes and/or geometry of features based on common key attribute values. Performs Left, Inner, and Full joins.
Typical Uses
- Performing simple joins between features, using attribute value(s) as keys
How does it work?
The FeatureJoiner performs simple join operations, much like a SQL join, without requiring knowledge of SQL query construction.
It has two input ports - Left and Right - where two streams of features to be joined are routed into the transformer. One or more attributes are selected to join on.
A Left feature matches a Right feature when every pair of keys specified in the Join On table has the same value. When a match occurs, attributes/geometry from the Left and Right feature are combined, and the combined feature is output to the Joined port.
Join Mode
The Join Mode parameter defines the type of join to be performed, determining which features will be output via the Joined output port.
Join Mode |
Joined Output |
|
---|---|---|
Inner |
|
|
Left |
|
|
Full |
|
Join Behavior
A Joined feature is produced each time a Left feature is matched to a Right feature through its keys. The number of output features produced will depend on whether or not multiple Left and Right features match.
The type of join is determined by the nature of the data used (it is not a parameter). Any of these types of joins may be produced by any of the Join Modes (Inner, Left, or Full).
Cardinality |
Description |
Output (assuming 1 key value) |
---|---|---|
1:1 | One to One: If each Left feature has a single match among the Right features (for example a single point feature is mapped to an address table via a unique address ID key), this is a 1:1 match and produces a single Joined feature. |
1 Left matches 1 Right: 1 Joined Feature output |
1:M | One to Many: If each Left feature has multiple matches among the Right features (for example a single address record is mapped to a list of planning applications for that address), this is a 1:M (one-to-many) match and produces a Joined feature for every match that occurs. |
1 Left matches 10 Right: 10 Joined Features output |
M:1 | Many to One: If multiple Left features match a single Right feature record (for example a number of addresses match to the same census data via a postal code field) this is a M:1 (many-to-one) match and produces a Joined feature for every match that occurs |
10 Left match 1 Right: 10 Joined Features output |
M:N | Many to Many: If multiple Left features match multiple Right features (for example a number of addresses match to a number of records for electrical power outages) this is a M:N (many-to-many) match and produces a Joined feature for every match that occurs. |
10 Left match 10 Right: 100 Joined Features output* *When all features have identical key values - all Left match all Right. |
Unmatched Features
Features (both Left and Right) that do not find a match are handled according to the Join Mode (Inner, Left, or Full). Both the Left and Full modes will result in some or all unmatched features being output via the Joined port, depending on Mode:
Join Mode |
Unmatched Left features output |
Unmatched Right features output |
---|---|---|
Inner | UnjoinedLeft | UnjoinedRight |
Left | Joined | UnjoinedRight |
Full | Joined | Joined |
In this example, we have a small dataset of Fire Halls, which have a street address, but do not have a complete postal address. The FeatureJoiner will perform a join to a dataset of addresses, and merge those attributes on to the Fire Halls.
The FIre Halls are connected to the Left input port, and the PostalAddress dataset to the Right.
In the parameters dialog, Join Mode is set to Inner. This will result in only features that have found a match being output. Unused addresses will not be included in the Joined feature output, nor will any Fire Halls that do not find a postal address match.
In the Join On table, we select the appropriate street address attributes for both the Left and Right features, and these values will be used as the key for joining.
Viewing the results from the Joined output port, you can see that the attributes from the postal address features have been added to the FIre Halls.
Usage Notes
- FeatureJoiner versus FeatureMerger:
- If the join requirements are simple, FeatureJoiner should give better performance.
- If join requirements are more complex, such as constructing keys, using expressions, naming conflict resolution, consider using the FeatureMerger.
- If you wish to get only one joined feature, regardless of the number of joins (1:M join produces 1 feature with a list of joins, rather than 1 feature for each join as the FeatureJoiner does), use the FeatureMerger.
- The FeatureJoiner does not perform some of the advanced list building or geometry handling operations that the FeatureMerger does, but these may be possible by using the FeatureJoiner plus other transformers.
- For complex joins using SQL syntax, or more than two input feature streams, consider using the InlineQuerier.
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 comprising the left table for the join.
Features comprising the right table for the join.
Output Ports
Joined output varies according to the Join Mode. In all cases, it will include features that found a match and were joined.
For Inner joins, no additional features are included.
For Left joins, Left features that did not find a match are also included.
For Full joins, Left and Right features that did not find a match are also included - that is, all features are output here whether joined or not.
Left features that did not find a match are output here, if the Join Mode is Inner .
For Left and Full joins, this port is unused.
Right features that did not find a match are output here, if the Join Mode is Inner or Left .
For Full joins, this port is unused.
Invalid features from any input port. Features will be rejected if a Join On value is missing or null.
Rejected Feature Handling: can be set to either terminate the translation or continue running when it encounters a rejected feature. This setting is available both as a default FME option and as a workspace parameter.
Parameters
Group By |
The input features may be partitioned by the Group By parameter. If you choose any Group By attributes, then references between features will only be resolved if they share a common value for the selected attributes. If you do not choose any Group By attributes, all features are processed together. If you have more than one Reader, a typical use is to group by reader_id to ensure that references are resolved within the correct set of features. Note: This is similar to an extra join key, with the subtle difference that Group-By values are allowed to be null/missing without causing a <Rejected> feature. A null/missing group-by is treated as an empty attribute. A null/missing key is treated as an invalid feature. |
Join Mode |
Specifies the type of join to perform.
Note: To perform a Right join, reverse the Left and Right input connections and use the Left Join Mode. |
|||||||||||||||
Attribute Conflict Resolution | When a joined feature receives an attribute with the same name (or a common attribute) from both the left and right features, this specifies which value should be preferred for the Joined output. | |||||||||||||||
Geometry Handling |
Specifies what geometry will be used for Joined features. Use Left: The geometry from the Left input will be used, and the geometry from the Right input will be discarded. Use Right: The geometry from the Right input will be used, and the geometry from the Left input will be discarded. Aggregate Left and Right (Enforce Unique Names): The geometry from both the Left and Right inputs will be preserved, and each geometry part will be given a unique name.
Geometry Aggregation Examples
|
The Join On table specifies the attributes to compare from the Left and Right inputs to determine matching features. A Left feature matches a Right feature when every pair of keys specified in the Join On table matches.
Left | Select the attribute from the Left feature stream to be used as a key. |
Right | Select the attribute from the Right feature stream to be used as a key. |
Comparison Mode | Specifies how to perform the comparison between Left and Right attribute values. If Automatic or Numeric is specified, an attempt will be made to convert attribute values to numbers before comparing them. |
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 FeatureJoiner on the FME Knowledge Center.
Examples may contain information licensed under the Open Government Licence – Vancouver