Skip to main content
Question

NeighborFinder and excluding candidates after matched

  • December 8, 2017
  • 9 replies
  • 123 views

Forum|alt.badge.img

Hello!

I am using NeighborFinder to match points from two different datasets. Once a point has been matched I would like to exclude it from the candidates. How would I do this?

9 replies

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • December 8, 2017

Hi @lojs, couldn't you use the features output from the UnmatchedCandidate port?


danilo_fme
Evangelist
Forum|alt.badge.img+41
  • Evangelist
  • December 8, 2017

Hi @lojs,

If you use the output port Unmatched Candidates from transformer Neighborfinder:

Thanks,

Danilo

 


Forum|alt.badge.img
  • Author
  • December 8, 2017

Hi! I don't think so as I would like to match a point only once from the candidates, then it is "used up", I don't want to have a point in the candidates matched by more than one basepoint.

I hope this made my question a bit clearer.


Forum|alt.badge.img+1
  • December 8, 2017

Hey @lojs,

I would try a Waterfall approach.

- assign a unique id to each candidate point.

- find the closest neighbor for each base point. (neighbors to find = 1)

- Check if more than 1 base are linked to the same candidate (based on the unique candidate_id) and keep the one with the closest distance.

- use a second neighborfinder to match the not linked bases to the not linked candidates.

You can repeat this process a third time if necessary or add a Maximum distance to check for neighbors (to ensure that your neighbors in the second iteration are not located on the opposite side of the map)

Your workspace should look something like this:

uniquecandidatesforeachbase.png


Forum|alt.badge.img+1
  • December 8, 2017
kd wrote:

Hey @lojs,

I would try a Waterfall approach.

- assign a unique id to each candidate point.

- find the closest neighbor for each base point. (neighbors to find = 1)

- Check if more than 1 base are linked to the same candidate (based on the unique candidate_id) and keep the one with the closest distance.

- use a second neighborfinder to match the not linked bases to the not linked candidates.

You can repeat this process a third time if necessary or add a Maximum distance to check for neighbors (to ensure that your neighbors in the second iteration are not located on the opposite side of the map)

Your workspace should look something like this:

uniquecandidatesforeachbase.png

Just to clarify: the features that are outputted in the 'Sampled' output port are in this case seen as linked correctly. The NotSampled ones need to be used in the second neighborfinder to match them with the unmatched candidates.

 

 


Forum|alt.badge.img
  • Author
  • December 8, 2017

Thank you for your answers, I'll try the waterfall approach.

Regards, Louise


dave29
Contributor
Forum|alt.badge.img+6
  • Contributor
  • November 25, 2019

I'm trying to do something similar. I'm trying to automate matching employees to work at shelters. I've created a shelter layer with a count field ordered by furthest distance from MBR centroid first and a field that has the number of employees needed. I have 47 shelters and I want to exclude employees after they are assigned to a shelter. I'm selecting one shelter at a time and running nearestneighbor, The first one assigns fine and I'm trying to loop within a custom transformer from unmatched candidates back to the candidate input. But, I'm getting "Transformer/Factory f_24 is blocking and cannot be used in a loop, but was found between 'Loop to test_Input1574712011 Input Splitter' and 'test_Input1574712011 Input Splitter"


dave29
Contributor
Forum|alt.badge.img+6
  • Contributor
  • February 25, 2020

The waterfall approach does work. But, I'm working with emergency shelters and the list changes every year. Right now I have 47 shelters and I'm using an AttributeFilter to feed all 47 of the NeighborFinders. Next year I may have 50 or 45. There must be a way to use the neighborfinder in a more dynamic way than a separate one for each shelter.


  • May 19, 2021
kd wrote:

Hey @lojs,

I would try a Waterfall approach.

- assign a unique id to each candidate point.

- find the closest neighbor for each base point. (neighbors to find = 1)

- Check if more than 1 base are linked to the same candidate (based on the unique candidate_id) and keep the one with the closest distance.

- use a second neighborfinder to match the not linked bases to the not linked candidates.

You can repeat this process a third time if necessary or add a Maximum distance to check for neighbors (to ensure that your neighbors in the second iteration are not located on the opposite side of the map)

Your workspace should look something like this:

uniquecandidatesforeachbase.png

Hi

This is exactly what I'am looking for aswell. Do you still have the screenshot "uniquecandidatesforeachbase.png" that shows the workspace? I could really need that to get some clues on how you solved the problem.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings