MYSQL about the distance between two latitude from near sort _mysql

Source: Internet
Author: User
Tags cos pow sin
Copy Code code as follows:

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

That's pretty much it, make a note.
But I think this is still very slow, because my coordinates are obtained through Baidu, my idea is to be able to turn the plane coordinates better, so that better calculation
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.