Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.47 KB | None | 0 0
  1. DELIMITER //
  2. DROP FUNCTION IF EXISTS GetDistance;
  3. CREATE FUNCTION GetDistance(currentLatitude FLOAT, currentLongitude FLOAT, latitude FLOAT, longitude FLOAT)
  4.     RETURNS FLOAT
  5.         DETERMINISTIC
  6.         BEGIN
  7.             RETURN ((ACOS(SIN(currentLatitude * PI() / 180) * SIN(latitude * PI() / 180)
  8.                 + COS(currentLatitude * PI() / 180) * COS(latitude * PI() / 180) *
  9.                 COS((currentLongitude-longitude) * PI() / 180)) * 180 / PI()) * 60 * 1.1515);
  10.         RETURN distance;
  11.         END //
  12. DELIMITER ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement