get a sorted table of distances