Question

Neighbourhood finder is showing same values for attributes after merging candidate


Hi,

 

I am trying to find the nearest river to points and then merge rivers attribute into points attribute. I am using neighbourhood finder, but in my results I see same values for the rivers attributes merged into the points.


7 replies

Badge +2

Hi @agrineersumit,

What are your Merge Attribute Parameter settings in the NeighbourhoodFinder? Could you provide a screenshot?

Hi Holly, did you get the screenshot?

Badge +2

Hi @agrineersumit,

No I do not see a screenshot attached, but let me try and explain what I think is happening and see if I can help you anyway.

I suspect that both your Point and River datasets contain attributes with a common name. This means that when you choose to Merge Attributes in the NeighbourFinder you need to tell FME how to handle this conflict.

By default Accumulation Mode=Use Candidate and for Conflict Resolution you can choose to keep the Attributes from either the Base or the Candidate dataset. Instead if you want to keep the Attributes from both datasets you have two options:

Option 1:

Change Accumulation Mode=Prefix Candidate which results in another Parameter setting made available called Prefix. Here you can specify a word e.g. River or Point and all the attributes associated with the candidate dataset will be renamed to include this Prefix. This will prevent there from being any conflicting attribute names between the two datasets

Option 2:

If you do not want to alter the Attribute Names then you can check the Generate List option. Using this method all associated attributes will create a list feature so what would have been a conflict will be a second list element that you can then work with downstream the translation.

 

 

The NeighbourFinder Documentation should also help you decide which option you'd prefer. If you have set this up and it's still not working as expected then please provide a workspace template so we can investigate further.

Hi @agrineersumit,

No I do not see a screenshot attached, but let me try and explain what I think is happening and see if I can help you anyway.

I suspect that both your Point and River datasets contain attributes with a common name. This means that when you choose to Merge Attributes in the NeighbourFinder you need to tell FME how to handle this conflict.

By default Accumulation Mode=Use Candidate and for Conflict Resolution you can choose to keep the Attributes from either the Base or the Candidate dataset. Instead if you want to keep the Attributes from both datasets you have two options:

Option 1:

Change Accumulation Mode=Prefix Candidate which results in another Parameter setting made available called Prefix. Here you can specify a word e.g. River or Point and all the attributes associated with the candidate dataset will be renamed to include this Prefix. This will prevent there from being any conflicting attribute names between the two datasets

Option 2:

If you do not want to alter the Attribute Names then you can check the Generate List option. Using this method all associated attributes will create a list feature so what would have been a conflict will be a second list element that you can then work with downstream the translation.

 

 

The NeighbourFinder Documentation should also help you decide which option you'd prefer. If you have set this up and it's still not working as expected then please provide a workspace template so we can investigate further.

HI,

 

I tried both of your suggestions but it didn't worked. I am also attaching the data.

WCC.gdb.zip

Hi @agrineersumit,

No I do not see a screenshot attached, but let me try and explain what I think is happening and see if I can help you anyway.

I suspect that both your Point and River datasets contain attributes with a common name. This means that when you choose to Merge Attributes in the NeighbourFinder you need to tell FME how to handle this conflict.

By default Accumulation Mode=Use Candidate and for Conflict Resolution you can choose to keep the Attributes from either the Base or the Candidate dataset. Instead if you want to keep the Attributes from both datasets you have two options:

Option 1:

Change Accumulation Mode=Prefix Candidate which results in another Parameter setting made available called Prefix. Here you can specify a word e.g. River or Point and all the attributes associated with the candidate dataset will be renamed to include this Prefix. This will prevent there from being any conflicting attribute names between the two datasets

Option 2:

If you do not want to alter the Attribute Names then you can check the Generate List option. Using this method all associated attributes will create a list feature so what would have been a conflict will be a second list element that you can then work with downstream the translation.

 

 

The NeighbourFinder Documentation should also help you decide which option you'd prefer. If you have set this up and it's still not working as expected then please provide a workspace template so we can investigate further.

Attached is the FME workflow:

watercrossingsaer2.fmw

Badge +2

Attached is the FME workflow:

watercrossingsaer2.fmw

Hi @agrineersumit,

Thank you for sharing your workspace and data. It appears the problem is actually because the NeighbourFinder is not finding any matches between the datasets so no merging of attributes is taking place. In your current set up all the data is coming out of the Unmatched Ports so the data is unchanged.

This is because you have set the Group By parameter to an attribute that is only present on the Candidate dataset. The GroupBy option allows you to group features so they will only find a nearest neighbour in the same group, meaning this attribute must be on both features. If you leave this as unset then the NeighbourFinder is able to find matches and therefore merge attributes.

There are a couple of issues with your workspace set up that you should make note of:

  • Your datasets are currently working in different coordinate systems, since you are performing a join it would be a good idea to align these.
  • In the NeighborFinder you have not set either Number of Neighbours to Find or the Maximum Distance - since this is what the transformer is designed for I recommend you set at least one of these otherwise the output may not be what you expect.
Userlevel 2
Badge +17

The coordinate system of river lines (LL-WGS84, in degrees) is different from the one of points (SPHERICAL_MERCATOR, in meters). That's the reason why you got the weird result, I think.

Try reprojecting the features into an identical coordinate system before inputting them into the NeighborFinder.

Reply