Add function for distance calculation for MySQL