Like you're hungry? Use map positioning to calculate coordinates how do you do this way around the restaurant?

Source: Internet
Author: User

Like this scene, click on the map to select a coordinate, you can locate the nearby how many takeout restaurant, arbitrarily drag the small rod, you can calculate any location near whether there is a restaurant, feel good advanced ah, how to achieve it?

Talk about my thoughts:
When the restaurant is open, there are three fields related to future location search: Longitude, latitude, distribution range (RADIUS/area) What's the point? I really don't think so.

Then use the Map API to get the latitude and longitude, and then what I don't know.

Want to know the great God to give me advice, thank you!

Reply content:

Like this scene, click on the map to select a coordinate, you can locate the nearby how many takeout restaurant, arbitrarily drag the small rod, you can calculate any location near whether there is a restaurant, feel good advanced ah, how to achieve it?

Talk about my thoughts:
When the restaurant is open, there are three fields related to future location search: Longitude, latitude, distribution range (RADIUS/area) What's the point? I really don't think so.

Then use the Map API to get the latitude and longitude, and then what I don't know.

Want to know the great God to give me advice, thank you!

This database to choose a native support Geo, MongoDB is a good choice.
Another: Mysql 5.7 also joins native support for Geo
In this business, the writing of latitude and longitude, the code logic of the query is the most important, the distance can be calculated by latitude

And then a big chunk of business logic is actually the front end.

Although you put this problem in PHP, but in fact, PHP in the middle does not play much role, or, the implementation of the difficulty is not PHP

The principle is that the Geohash,geohash principle creates a GEO index on all the POI, and then uses the known coordinates to find the desired poi, which is then displayed on the map.

In simple words, MongoDB natively supports Geohash, and the map provider also provides this service.

  • 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.