Question

NeighborFinder and excluding candidates after matched

  • 8 December 2017
  • 9 replies
  • 18 views

Badge

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

Userlevel 2
Badge +17

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

Userlevel 4
Badge +30

Hi @lojs,

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

Thanks,

Danilo

 

Badge

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.

Badge +1

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

Badge +1

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.

 

 

Badge

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

Regards, Louise

Badge +1

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"

Badge +1

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.

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.

Reply