FME Transformers: 2024.1
FME Transformers: 2024.1
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.
Note that all input features must have the same coordinate system, both Left and Right.
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 Join Mode:
Join Mode |
Unmatched Left features output |
Unmatched Right features output |
---|---|---|
Inner | UnjoinedLeft | UnjoinedRight |
Left | Joined | UnjoinedRight |
Full | Joined | Joined |
Examples
Example: Joining features
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.
- The FeatureMerger may be able to join features with different coordinate systems.
- For complex joins using SQL syntax, or more than two input feature streams, consider using the InlineQuerier.
- If input features are not all in the same coordinate system, the CoordinateSystemSetter, Reprojector, and related transformers may be useful.
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
Left
Features comprising the left table for the join.
Right
Features comprising the right table for the join.
Output Ports
Joined
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.
UnjoinedLeft
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.
UnjoinedRight
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.
<Rejected>
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 Processing
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.
|
||||
Complete Groups
|
Select the point in processing at which groups are processed:
Considerations for Using Group By
There are two typical reasons for using When Group Changes (Advanced) . The first is incoming data that is intended to be processed in groups (and is already so ordered). In this case, the structure dictates Group By usage - not performance considerations. The second possible reason is potential performance gains. Performance gains are most likely when the data is already sorted (or read using a SQL ORDER BY statement) since less work is required of FME. If the data needs ordering, it can be sorted in the workspace (though the added processing overhead may negate any gains). Sorting becomes more difficult according to the number of data streams. Multiple streams of data could be almost impossible to sort into the correct order, since all features matching a Group By value need to arrive before any features (of any feature type or dataset) belonging to the next group. In this case, using Group By with When All Features Received may be the equivalent and simpler approach. Note Multiple feature types and features from multiple datasets will not generally naturally occur in the correct order.
As with many scenarios, testing different approaches in your workspace with your data is the only definitive way to identify performance gains. |
Join Mode
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 |
Select a preference for choosing attributes when a joined feature receives an attribute with the same name (or a common attribute) from both the Left and Right features.
When Join Mode is Full, the selection will be preferred - Unjoined features will not have attribute values overwritten with nulls if the opposite (left versus right) preference is selected. When Join Mode is Inner or Left, the selection will be used for all cases. |
|||||||||||||||
Geometry Handling |
Specifies what geometry will be used for Joined features.
Geometry Aggregation Examples
|
Join On
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
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 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 Community.
Examples may contain information licensed under the Open Government Licence – Vancouver, Open Government Licence - British Columbia, and/or Open Government Licence – Canada.