Home > Database > Mysql Tutorial > body text

MYSQL 关于两个经纬度之间的距离由近及远排序_MySQL

WBOY
Release: 2016-06-01 13:25:12
Original
1259 people have browsed it

bitsCN.com
select *,(2 * 6378.137* ASIN(SQRT(POW(SIN(PI()*(111.86141967773438-lat)/360),2)+COS(PI()*33.07078170776367/180)* COS(lat * PI()/180)*POW(SIN(PI()*(33.07078170776367-lng)/360),2)))) as juli from `area` 
order by juli asc limit 0,20

差不多就是这样的,做个记录
但是我觉得这样还是很慢,因为我的坐标都是通过百度获取的,我的想法是能够转成平面坐标更好,这样更好计算
bitsCN.com

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!