计算两点距离

CREATE DEFINER=`root`@`%` FUNCTION `tow_point_distance_function`(lat1 INTEGER,lng1 INTEGER,lat2 INTEGER,lng2 INTEGER ) RETURNS int(11)
BEGIN

RETURN round(2 *6378.137 * asin(sqrt(power(sin((radians(lat1) - radians(lat2))/2),2) + cos(radians(lat1))*cos(radians(lat2))*power(sin((radians(lng1) - radians(lng2))/2),2)))*1000)/1000;
 
END

 

你可能感兴趣的:(计算)