The solution has been solved by using geohash. The idea is to use geohash to calculate the user's latitude and longitude, and calculate the latitude and longitude of the user's merchants using geohash as average. Then, we can make a comparison, you can paste two links to the geohash class Link Description operation method Link Description ---------- split line ------...
The solution has been solved by using geohash. The idea is to use geohash to calculate the user's latitude and longitude, and calculate the latitude and longitude in the merchant's own business using geohash. Then, we can compare it.
Paste two links
Geohash Link Description
Operation Method Link Description
---------- Split line ------------------
We are currently working on a page, similar to the features of sellers near the Meituan page
Requirements: Displays information about nearby merchants and shows the distance (for example, 1000 meters)
CurrentlyBaidu LBS Open Platform: Browser PositioningTo user dimension
The database also savesBusiness longitude and latitudeI heard that Baidu appstore also has a range-based api, but I don't know how to integrate it into a piece.
How should we develop this?
Reply content:
The solution has been solved by using geohash. The idea is to use geohash to calculate the user's latitude and longitude, and calculate the latitude and longitude in the merchant's own business using geohash. Then, we can compare it.
Paste two links
Geohash Link Description
Operation Method Link Description
---------- Split line ------------------
We are currently working on a page, similar to the features of sellers near the Meituan page
Requirements: Displays information about nearby merchants and shows the distance (for example, 1000 meters)
CurrentlyBaidu LBS Open Platform: Browser PositioningTo user dimension
The database also savesBusiness longitude and latitudeI heard that Baidu appstore also has a range-based api, but I don't know how to integrate it into a piece.
How should we develop this?
If you have a merchant's latitude and longitude, baidu should have an api for calculating the distance. If you do it yourself,
1. Use mongodb
2. Use the geohash algorithm to save the longitude and latitude as hash.
The question is rough. I can only tell you about my method in general, and I have done something similar.
1. Store the merchant's location information in segments according to the city,
2. the browser obtains the user location and uses Baidu's map js api.
3. Calculate a rectangle centered on the user location.
4. Match the longitude and latitude values and distance values in the database to obtain appropriate merchant information.
5. displayed
MongoDB supports location-based Query
Baidu:
redis geo
Ormongodb geo
Orpostgresql geo
Ormysql geo
I didn't even mention it,
Use Baidu map API →IOV APIs
: Measure the linear distance between multiple points.
IOV APIs
To obtain the line distance: RequiredDirection API
Http://developer.baidu.com/map/index.php? Title = webapi/direction-api