mysql 计算经纬度函数(米)
时间:2021-07-01 10:21:17
帮助过:4人阅读
DEFINER
=`root`@`
%`
FUNCTION `latlon`(lat1
DOUBLE,lon1
DOUBLE,lat2
DOUBLE,lon2
DOUBLE)
RETURNS varchar(
200) CHARSET utf8mb4
begin
return ROUND(
6378.138 * 2 * ASIN(
SQRT(
POW(
SIN(
(
lat1 * PI()
/ 180 - lat2
* PI()
/ 180
) / 2
),
2
) + COS(lat1
* PI()
/ 180)
* COS(lat2
* PI()
/ 180)
* POW(
SIN(
(
lon1 * PI()
/ 180 - lon2
* PI()
/ 180
) / 2
),
2
)
)
) * 1000
);
end
mysql 计算经纬度函数(米)
标签:经纬 pow roo col color fine var cti ret