1:计算距离
mysql空间函数汇总_ununie的博客-CSDN博客_mysql空间函数名称描述1ST_StartPoint()LineString的起始点2ST_EndPoint()LineString的终点3ST_Transform()变换几何的坐标4ST_GeoHash()产生geohash值5ST_LongFromGeoHash()从geohash值...https://blog.csdn.net/ununie/article/details/101014849
select
*,
ST_Distance_Sphere(ST_GeomFromText('POINT(114.28345822284 22.6916483239028)'),ST_GeomFromText(CONCAT('POINT(',c_gcj02_lng,' ',c_gcj02_lat,')'))) as distance
from lgq_um_event where data_source!='wg' and c_source_name='视频智能抓拍案件' and community_area_name='南约'
2:计算距离
SELECT
*,
ROUND(
6378.138 * 2 * ASIN(
SQRT(
POW(
SIN(
(
22.694473691335844 * PI() / 180 - c_wgs84_lat * PI() / 180
) / 2
),
2
) + COS(22.694473691335844 * PI() / 180) * COS(c_wgs84_lat * PI() / 180) * POW(
SIN(
(
114.27862657654101 * PI() / 180 - c_wgs84_lng * PI() / 180
) / 2
),
2
)
)
) * 1000
) AS juli
FROM
lgq_um_event where data_source = 'wg'
ORDER BY
juli desc