Skip to main content

When using Matcher, "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."

How do attributes get merged (which ones are kept and which lost), and what happens to geometry?

With FeatureMerger, you choose which source attributes are output, so you know what you're going to get.

This is based on sending 2 source datasets (old and new) to Matcher for comparison on an ID field. Should Matcher only be used on a single dataset?

The attributes on the single Matched output port will be accumulated in a list, with the name of the list provided as in the image:


The attributes on the single Matched output port will be accumulated in a list, with the name of the list provided as in the image:

Thanks - I didn't spot that.

 

So if you don't specify a list name or match count attribute name, you won't see it in the output.

 

But the features output through the SingleMatched port do have non-list attributes - are these the attributes of the first "version" of the matched feature that entered the transformer?

 


The Matcher documentation states:

"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. So, Matcher is capable of doing multi-feature merging with geometry as the key. This complements FeatureMerger, which only accepts attributes, and not geometries, as keys."

Naturally if the same attributes exist on both features a different approach is necessary (prefixing is one way) to avoid the conflict.


The Matcher documentation states:

"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. So, Matcher is capable of doing multi-feature merging with geometry as the key. This complements FeatureMerger, which only accepts attributes, and not geometries, as keys."

Naturally if the same attributes exist on both features a different approach is necessary (prefixing is one way) to avoid the conflict.

Yes but what attributes win?

 

If you've got these features going to the Matcher in this order, and being matched on the ID...

 

ID = 1, Field1 = A, Field2 = B, Field3 = C, Geometry = 123,654

 

ID = 1, Field1 = X, Field2 = <null>, Field3 = Z, Geometry = 123,654

 

What will the SingleMatched output attributes be if no list name is specified?

 


Hi @tim_wood, in my observation, the merging rule seems to be first win for each attribute as well as the "Merge Incoming Attributes" option in other transformers such as Aggregator. For example:

IDfieldAfieldBfieldCfieldDfidleEfieldF1A1<missing><null><missing><missing><missing>2A2<missing>C2<missing><null>F23<missing>B3C3D3E3F3

If the input is ordered by ID and all of them are matched, the single matched feature will have:

IDfieldAfieldBfieldCfieldDfieldEfieldF1A1B3<null>D3<null>F2

Hi @tim_wood, in my observation, the merging rule seems to be first win for each attribute as well as the "Merge Incoming Attributes" option in other transformers such as Aggregator. For example:

IDfieldAfieldBfieldCfieldDfidleEfieldF1A1<missing><null><missing><missing><missing>2A2<missing>C2<missing><null>F23<missing>B3C3D3E3F3

If the input is ordered by ID and all of them are matched, the single matched feature will have:

IDfieldAfieldBfieldCfieldDfieldEfieldF1A1B3<null>D3<null>F2
See also this attachment (FME 2016.1.3): matcher-singlematched-merging-attributes-rule.fmw

 


Reply