relink function

Relink IDs to closest duplicate appearance based on coordinates