is_near function modified to account for the earth curvature