Skip to main content
I have a set of base points and a set of candidate points. I want to merge the attributes from candiates points to the closest base points based on a group_id variable only existing in the candidate attributes. So the results should be a very wide dataset containing the original base attributes and candidate attributes from different group_id (possibly distinguished by adding group_id as suffix to the candidate variables).

 

 

At first I thought this can be easily done in neighbour finder using the Group By option. But it turned out to be unsuccessful. My understanding is that the Group By only works if both base and candidate have the same group_id. So anyone could help me out joining datasets only using the grouping in one dataset?

 

 

Cheers

 

 

 

So if I understand correctly, you have a group of base features (call them 😵 and a group of candidate features (Y).  The Y features all have a group_id attribute (values of A,B,C) and some other attributes (attr1, attr2).

On each X feature you want A-attr1, A-attr2, B-attr1, B-attr2, C-attr1, C-attr2.

I would try something like creating a list of all the group_id values of the Y features

 

Use a counter to create a unique id for the X features.

 

Attach the list to the X features, then  explode the list, so you now have duplicate X features each with a relevant group_id.

 

 

Send all the Xs and the original Ys to the neighbourfinder (set the group by), under the Attribute Accumulation, set the mode to Prefix Candidate with Prefix group

 

 

Aggregate the matched features, grouping by the unique id, keep input attributes to Yes

 

 

Presumably the GeometryPartExtractor would let you get just the first part, of the aggregate, but I don't know enough about the geometry xquery syntax to be sure.

Alternately use the deaggregator followed by a tester for part number =0 to get back you original X geometry.


Hi JDH,

 

Thanks for the suggestion. I genereally understand the concept of creating duplicate X features which creates common group_id variable to merge with Y. However in practice could you please be more specific about how to create a list of the groud_id values and how to attach to X then explode to give the duplicate X features. I have only mastered some basic transformers in FME so please pardon me if the request is too much.

 

 

Cheers. 
Hi,

 

 

How about this?

 

(1) Send the Y features to a DuplicateRemover (Key Attributes: group_id).

 

(2) Connect a ListBuilder (or an Aggregator) to the Unique port of the DuplicateRemover to create group_id list (_list{}.group_id).

 

(3) Merge the list to every X feature unconditionally with a FeatureMerger (set a constant value e.g. 1 to the "Join On" parameter).

 

(4) Use a ListExploder to explode the X features by the list.

 

 

Takashi
Hi Takashi,

 

 

Thanks for the instructions. It works great.

Reply