Skip to main content

I have two point files and need to identify the nearest point in file A to the nearest point in file B, however the matching must be unique. Meaning once a point in file B is matched to a point in file A it cannot be matched to any other point in file A.

I can match them using nearest neighbor but don't see a way to restrict to eliminate duplicate matching, so I end up with the same point in file B matched to multiple points in file A.

opph, thats a good one….

I think its probably going to have to be a recursive (looping) process.

My first thought jumps to a python process that takes a point from pc A and finds the closest point in pc b. You then remove that point from pc b and take the next point from pc A. However, thats probably not going to give you an optimal solution, and assumes you have the same number of points in each pc.

Take the below as an example:
 

 

start with pb1 and the closest is pa3, next pb2 goes to pa2, then pb3 can only match to pa1.

  • pb1 - pa1
  • pb2 - pa2
  • pb3 - pa3

This isn’t optimal as pb3 should optimally match to pa3 as that is much closer than pa1, but pa3 has already matched to pb1


Reply