FeatureMerger
将一组特征的属性和/或几何合并到另一组特征上,基于匹配key attribute values and expressions.
Typical Uses
- Combining attributes and/or geometry from two different streams of features, based on a common key attribute value or expression.
它是如何工作的?
的FeatureMergerreceives two streams of features via its input ports.
请求者:Requestorsare the features that will receive new attributes and/or geometry.
供应商:供应商sprovide attributes and/or geometry to be merged onto the Requestors.
匹配Requestorand供应商are identified according to theJoin Onconfiguration in the parameters dialog. The Join conditions can be simple or complex, using attribute values, constants, functions, or a combination of any of these in expression form. Multiple join conditions can be defined (features must meet all conditions to match).
When aRequestorfinds a matching供应商,属性和/或几何来自供应商are merged onto theRequestor。
- 如果the Requestor already has an attribute that the Supplier also has, the Requestor's original value for that attribute can be preserved or overridden.
- A single Supplier may be used by many Requestors.
- 许多供应商可以合并到单个请求者上。
- 当属性名称冲突时,你可以选择磨her Requestor or Supplier attribute values are maintained by using the解决冲突parameter, and whether null values follow the same behavior by using the忽略nulls.parameter.
Requestorfeatures match供应商每对键(支持表达式)时的功能Join Ontable has the same value for both theRequestorand供应商features.
例子s
In this example, we have two datasets - a CSV text file of historical crime reports, and a shapefile of public streets. Both of the datasets have one piece of information in common, that is an address in the form of “hundred” block.
TheFeatureJoiner这可能更有效地执行简单的属性值加入,但是,每个数据集中地址的格式略有不同。CSV数据使用字符串“XX”代替地址中的零:
And the street data has the more conventional form, with zeroes:
Our goal is to merge the street geometry onto the crime data - producing one output feature for each crime record. And so, The CSV data is routed into theRequestorinput port, and the streets are routed into the供应商port.
在“参数”对话框中,我们需要创建一个Join On双Requestorand供应商values. As the format of the addresses is not identical, we will adjust one, constructing a key. With the assistance of the Text Editor, we create an expression that will replace the “XX” of the address with “00”, and so match the format of the street (Supplier) data.
配对的其他一半是属性值HBLOCKfrom the street data.
Feature Merge Type是set toAttributes and Geometry。The default values forAttribute Accumulation(Merge Supplier) will provide the correct results.
TheMergedoutput contains crime records, now with geometry for the street and associated street attributes. Note that the address format was not actually changed by the constructed expression - it was just used for matching evaluation. In this location, 137 crime records were found. Each one now has (identical) geometry.
To see this example reversed - attaching all crime records to a single street - see the next example.
In this example, we reverse the scenario in the above example. We want to merge all the historical crime records onto the street data, producing one record per street line segment (block), with alist attributecontaining the crime data.
In this case, the streets are theRequestorfeatures, and the crime data is the供应商。
In the parameters dialog, we again create aJoin Onpair, using an expression to match the two (slightly different) hundred block formats. TheFeature Merge Type是仅属性, as the Requestors (streets) already have the desired geometry.
Process Duplicate Suppliers是enabled. Without this, the first match would be processed and the remainder discarded. A count of how many Suppliers (crimes) matched will be kept in theNumber of Suppliers Attribute, namedIncident_Count。
Generate List是enabled, and given theList NameofCrime_Records。We will add onlySelected Attributesto the List, and chooseTYPEandYEAR。
TheMergedoutput features now have alist attribute,包含来自CSV的所有匹配记录。注意incident_count属性。
Usage Notes
- For simple joins, theFeatureJoinermay provide better performance than the FeatureMerger. However, the FeatureJoiner only accepts attribute values as keys and not constructed expressions, and does not support list attributes. Additionally, the FeatureMerger is able to (optionally) restrict output to one feature in the case of multiple matching Suppliers, whereas the FeatureJoiner will create multiple features for all matches.
- For complex joins using SQL syntax, or more than two input feature streams, consider using theInlineQuerier。
- 需要多种特派虫的情况下,考虑使用InlineQuerierinstead.
- 如果要查询的所有数据已经存在于能够的SQL的数据源中,则使用始终更有效SQLCreatororSQLExecutor, which allows the queries and filtering of the data to be executed directly by the database before it enters the FME environment.
- To perform a join between features already in the workspace and data residing in an external database, consider theDatabaseJoiner。
- To perform a join where the Requestor key is alist attribute, consider using theListBasedFeatureMerger。
- To join features onmatching geometry,考虑一下Matcher。的FeatureMergerdoes not accept geometry as a key.
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 supportlist attributereading and creation.
通常,选择最专用于您需要完成的任务的那个将提供最佳性能结果。如果有多种方式来做(通常是这种情况),则在性能测试备用方法上花费的时间可能是值得的。性能可能会因读取外部表而存在的密钥索引(而不是在工作区中的功能)时变化。
Transformer |
搭配 |
Uses SQL Statements |
Can Create List |
Input Type |
Notable |
Description |
---|---|---|---|---|---|---|
FeatureJoiner | Attributes | No | No | Features |
|
通过基于公共密钥属性值组合特征的属性和/或几何来连接功能。执行相当于内部,左和完整的SQL连接。 |
FeatureMerger | Attributes | No | Yes | Features |
|
将一组特征的属性和/或几何合并到另一组特征上,基于匹配key attribute values and expressions. |
ListBasedFeatureMerger | List Attribute to Single Attribute | No | Yes | Features |
|
将一组特征的属性和/或几何合并到另一组特征上,基于匹配list attributevalues with key attribute values and expressions. |
InlineQuerier | SQL query | Yes | No | Features |
|
从传入功能创建一组SQLite数据库表,对它们执行SQL查询,并将结果作为特征输出。 |
SQLCreator | SQL query | Yes | No | External DB |
|
生成FME功能,从对数据库执行一次SQL查询的结果。为SQL查询结果的每行创建一个FME功能。 |
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 |
|
基于公共密钥或键,将外部表中的属性从外部表加入到工作区中的功能。不需要SQL知识。非阻塞变压器。 |
Matcher | 几何和/或属性 | 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. 如果matching on attributes only (not geometry), using the FeatureMerger or another method will give better performance. |
Configuration
Input Ports
Features that will receive new attributes and/or geometry from the features connected to the供应商port.
The source of new attributes and/or geometry for features that enter through theRequestorport.
Note that by settingProcess Duplicate SupplierstoYes, more than one Supplier may be merged to each Requestor. These Suppliers potentially could come from different sources (such as different database tables).
输出端口
匹配供应商的请求者(或可能的多个供应商,如果Process Duplicate Suppliers是set toYes)。
Requestors that donot匹配任何供应商。如果一个Join Onkey is null or missing on a Requestor feature, that feature is output onto this port.
供应商s that are found by at least one Requestor.
Note: ">Note:A Supplier may still be output through this port even though none of its attributes were merged. This can occur because all of the attributes were already present in the Requestor or were provided by earlier Suppliers.
供应商s that donot匹配任何请求者。如果一个Join Onkey is null or missing on a Supplier feature, that feature is output onto this port.
如果Process Duplicate Suppliers是No, then duplicate suppliers will be rejected. IfReject Null and Missing Keys是Yes,然后将拒绝钥匙特征。
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 defaultFME optionand as a工作区参数。
Parameters
Group By | 输入特征可以由此划分Group Byparameter. If you choose anyGroup Byattributes, then references between features will only be resolved if they share a common value for the selected attributes. 如果you do not choose anyGroup Byattributes, all features are processed together. 如果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. |
小组按模式 | Process At End (Blocking): This is the default behavior. Processing will only occur in this transformer once all input is present. Process When Group Changes (Advanced): This transformer will process input groups in order. Changes of the value of the Group By parameter on the input stream will trigger processing on the currently accumulating group. This may improve overall speed (particularly with multiple, equally-sized groups), but could cause undesired behavior if input groups are not truly ordered.
Considerations for UsingGroup By
使用两种典型的原因Process When Group Changes (Advanced)。第一个是旨在以组(并且已如此有序处理)的传入数据。在这种情况下,该结构通过使用来指示组 - 不是性能考虑因素。 The second possible reason is potential performance gains. Performance gains are most likely when the data is already sorted (or read using aSQL订单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 aGroup Byvalue need to arrive before any features (of any feature type or dataset) belonging to the next group. In this case, usingGroup By和Process At End (Blocking)may be the equivalent and simpler approach. Note: ">Note:来自多个数据集的多种特征类型和特征通常不会以正确的顺序自然地发生。 As with many scenarios, testing different approaches in your workspace with your data is the only definitive way to identify performance gains. |
供应商s First | When this option is enabled, the transformer will assume that all Suppliers will enter the transformer before any Requestors. Once the first Requestor arrives, it will process and output Requestors as they come in. The Suppliers will be output after all the Requestors have been processed. Note: ">Note:用户有责任确保所有供应商在请求者面前到达。在启用此选项时,转换器将停止接收供应商,当启用此选项时收到其第一个请求者。 |
Requestor | Specify an expression from theRequestorfeature to match with the供应商feature expression. An expression can be a constant, attribute value, function or mixture. Leading and trailing space characters are trimmed from the evaluated expressions. Matches are made when the trimmed values of all the Requestor expressions equal the trimmed values of their corresponding Supplier expressions. |
供应商 | Specify an expression from the供应商feature to match with theRequestorfeature expression. An expression can be a constant, attribute value, function or mixture. Leading and trailing space characters are trimmed from the evaluated expressions. Matches are made when the trimmed values of all the Requestor expressions equal the trimmed values of their corresponding Supplier expressions. Generally, the Suppliers will have expressions defined that result in a unique match with a Requestor, and any duplicate Suppliers are ignored by the transformer. However, if theProcess Duplicate Suppliersparameter is set toYes, then all Suppliers whose expressions match their corresponding Requestor expressions will be combined onto that Requestor. |
比较模式 | The Comparison Mode column specifies how to perform the comparison betweenRequestorand供应商attribute values. If Automatic or Numeric is specified, an attempt will be made to convert attribute values to numbers before comparing them. |
Feature Merge Type | This parameter specifies what to merge onto the completed feature. Choices include:
|
Reject Null and Missing Keys | Yes:Any Requestor or Supplier feature that contains a null or missing join key is output via the No:Null and missing keys are treated as empty strings. |
如果more than one Supplier is found for a given Requestor, andProcess Duplicate Suppliers是not enabled, then every Supplier after the first is output via the
如果Process Duplicate Suppliers是enabled, duplicate Suppliers are all matched with the corresponding Requestor. Attributes are merged based on the Attribute Accumulation mode, and optionally output as alist attributeof the Requestor, using the specifiedList Name。The Supplier geometry is merged using the specifiedGeometry Merge Type。
请注意,启用Generate Listalso implicitly enablesProcess Duplicate Suppliers。
Geometry Merge Type | Specifies how to merge duplicate Suppliers onto the Requestor. It is applicable only ifFeature Merge Type指定合并几何。选择包括:
|
||||||||||||||||||
Tolerance | The minimum distance between geometries in 2D before they are considered equal, in ground units. If the tolerance isNone, the geometries must be exactly identical to be considered equal. If the tolerance is自动的, a tolerance will be automatically computed based on the location of the input geometries. Additionally, a custom tolerance may be used. |
||||||||||||||||||
Connect Z Mode | 如果一个pplicable, select a method for handling z values.
Connect Z Mode
When viewed in 2D (ignoring Z), a path (which may define the border of a polygon) may appear to be closed as shown in the left figure below. This same path, when viewed in 3D, may appear to be open as shown in the right figure below. To specify how (and if) paths should be closed in 3D, select one of the listed modes.
|
||||||||||||||||||
Number of Suppliers Attribute | The name of an attribute which will store a count of the number of Suppliers matched a Requestor. |
如果一个ttributes on the Supplier and Requestor feature share the same name, but are not geometry attributes that start withfme_,then they are deemed conflicted.
Accumulation Mode | Merge Supplier:请求者功能将保留所有自己的未冲突属性,并且还将获得供应商功能具有的任何未冲突的属性。此模式将根据此模式处理冲突属性解决冲突parameter. Prefix Supplier:请求者特性将保留自己的所有attributes. In addition, the Requestor will acquire attributes reflecting the supplier feature’s attributes, with the name prefixed with thePrefixparameter. Only Use Supplier: The Requestor feature will have all of its attributes removed, except geometry attributes that start withfme_。Then, all of the attributes from one (arbitrary) supplier feature will be placed onto the Requestor. |
解决冲突 | Use Requestor: If a conflict occurs, the Requestor values will be maintained. Use Supplier: If a conflict occurs, the values of the supplier will be transferred onto the Requestor. |
忽略nulls. | No: Treat null attribute values like other attribute values. Yes: Treat null attribute values as less important than other attribute values. Whenever a null value is merged with a non-null value, the non-null value shall prevail, regardless of what解决冲突是set to. Note: ">Note:空和其他属性值总是多做minant than missing attribute values. That is, whenever an attribute value is merged with a missing attribute value, the attribute value shall prevail, regardless of the忽略nulls.and解决冲突settings. |
Prefix | To prevent a Supplier attribute from being ignored because the Requestor attribute already exists, you can optionally specify a prefix that will be applied to each Supplier attribute when it is added to the Requestor. When there are multiple Supplier features for a Requestor feature, multiple Supplier attribute values are merged into the same prefixed attribute. When multiple Supplier features have the same attribute, generally the resulting attribute value is taken from the last of these features. However, this process is governed by the忽略nulls.parameter. |
如果there are duplicate Suppliers andGenerate List已启用,然后与请求者组合的任何供应商都将其属性添加到请求者上的指定列表中。请注意,启用Generate Listalso implicitly enablesProcess Duplicate Suppliers。
Note: ">Note:List attributesare not accessible from the output schema in Workbench unless they are first processed using a transformer that operates on them, such asListExploderorListConcateator。Alternatively,AttributeExposercan be used.
List Name | Enter a name for the list attribute. |
Add To List | 所有属性:与请求者组合的供应商的每个属性都将添加到指定的列表中in List Name。 Selected Attributes:Only the attributes specified in theSelected Attributesparameter will be added to the list specified inList Name。 |
Selected Attributes | The attributes to be added to the list whenAdd To List是Selected Attributes。 |
保留特征顺序 | This parameter controls the order in which features exit a transformer. When a transformer has more than one output port, features usually exit one port at a time. At times, it may be useful to keep the order that features arrived in, switching from port to port as necessary. This allows feature order to be preserved, though at a potential cost in processing efficiency. Select a method for feature ordering.
|
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, clickbeside the applicable parameter. For more information, seeTransformer 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.
设置值 - 无论是否直接在参数中输入或使用其中一个编辑器和包含字符串的表达式都是构造的,都会评估这些函数的字符串和表达式。因此,这些函数的名称(以@ <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 return primarily feature-specific values. | |
可以使用FME和工作区的参数。 | |
Creating and Modifying User Parameters | Create your own editable parameters. |
Dialog Options - Tables
Transformers with table-style parameters have additional tools for populating and manipulating values.
Row Reordering |
启用后,单击行项目后。选择包括:
|
Cut, Copy, and Paste |
启用后,单击行项目后。选择包括:
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. |
进口 |
进口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.
Reference
Processing Behavior |
|
Feature Holding |
Yes |
Dependencies | None |
Aliases | |
History |
FME Community
FME社区是演示亚搏国际在线官网,TOS,文章,常见问题和更多的地方。获取您的问题的答案,从其他用户学习,并建议,投票和评论新功能。
Search forall results about the FeatureMergeron the FME Community.
例子s may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.