calc_distance function

Calculate Distance from Reference