I have two point datasets, GPoints (~100 points) and OPoints (~1000 points), and I want to find the nearest neighbor for each GPoints entry. However, the nearest neighbor from OPoints must have an ID that matches the values from 2 possible columns in GPoints. In this case the column names are id1 and id2.
Â
E.g.The first entry in GPoints has values of id1 = 9001 and id2 = 9005. Therefore the nearest neighbor from OPoints must have an id of 9001 or 9005 (whichever is closest to the entry in GPoints current being analyzed). In SQL this would be WHERE OPoints.id = GPoints.id1 OR OPoints.id = GPoints.id2.