Question

Matcher - how do attributes get merged in SingleMatched output port?

  • 21 December 2016
  • 6 replies
  • 13 views

Badge +7

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?


6 replies

Userlevel 2
Badge +16

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:

Badge +7

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?

 

Badge +16

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.

Badge +7

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?

 

Userlevel 2
Badge +17

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
Userlevel 2
Badge +17

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