In Baidu Map, how does one search for N coordinates in the near distance of a database based on a coordinate point?

Source: Internet
Author: User
In Baidu Map, how to search for N coordinate points nearby in the database based on a coordinate point: some coordinate points (more than W) are stored in the existing php + mysql database, what if I used a coordinate point to obtain all the matching information within 1 km? The lng latitude field lat in the longitude field of the database .. Baidu map is used. Online, etc. thank you ., Sorting coordinate columns filter records with Euclidean distance matching conditions Baidu Map, how to search for N coordinate points in the distance near the database based on a coordinate point
Environment: php + mysql

The existing database stores some coordinate points of longitude and latitude (more than W,

What if I used a coordinate point to obtain all the matching information within 1 km?

The lng latitude field lat in the longitude field of the database ..

Baidu map is used.

Online, etc. thank you.


------ Solution --------------------
Sort coordinate column
Filter records with Euclidean distance matching conditions
------ Solution --------------------
I think:

Since the longitude and latitude of the central point are available, you can calculate the approximate longitude and latitude range of N kilometers based on the dimension .. The result is a 2N * 2N square,

For example, at 34.5 ° north latitude, there is no need to find 35 + or 34-North latitude points within 1 km. the specific conversion can be done in the program first.

However, you still need to filter some parts outside the circular radius N,

If this is the case, as long as the lng lat is combined with the index, the size of the index is 1 million and the index is very fast.

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.