Potential Infinite Loop in KDTree
If max_depth is set to inf, and two (or more) Records have the same lon and lat, they cannot be split and will infinitely be assigned to the child_left node. max_depth = inf is the standard form for a KDTree as each leaf should have only a single Record.
The previous approach of splitting the array in the middle would not lead to an infinite loop, however it this means that the child_left and child_right nodes can have Records with the same variable value. This could impact performance when querying, and make it more difficult to delete Records from the Tree.