@stevor wrote:
1. The function 2PL_NearTL is a function, not a command.
2. To use it, supply the 2 lists of coordinates to be matched;
....
I'm getting a syntax error when I run that, and also with a different approach I was trying -- I suspect it may have something to do with nesting (foreach) functions, but I'm not sure, and haven't dug very deep yet.
But if I understand what yours is meant to do, I have a question:
Say it looks at the first point in the PL1 list -- I'll call it ptA. And it steps through the PL2 list and compares the distance from ptA to each point in PL2, and finds the closest one -- I'll call that ptZ. So a list that pairs ptA with ptZ goes into the NATL list.
Now, it goes on to later points in the PL1 list. If it finds one -- I'll call it ptB -- that's closer to ptZ than ptA was, it looks like it removes the list that pairs ptA with ptZ, and puts in its place a list that pairs ptB with ptZ instead. Fair-enough -- if it's closer, that should be the pairing.
But it doesn't look like anything else is ever done with ptA after that. So there's no pairing of ptA with [presumably] the next-closest point to it from the PL2 list. Am I correct that it's meant to work that way, and that ptA will not get a partner? Or am I misunderstanding how it works? [I wanted to test it and check the result, but haven't been able to diagnose the syntax error yet.]
In the OP's case, I would think every point in one list wants to end up paired with one from the other, but not having gotten answers to most of my questions about it, I'm not sure of that, either.
Kent Cooper, AIA