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.