closest_dup function

Find the closest duplicate appearance based on coordinates