This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is the code i have written to obtain the current user geolocation with react redux. I have this sql query to show 20 items according to their point of interest within 25 miles to their current location | |
``` | |
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) | |
* cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin(radians(lat)) ) ) | |
AS distance | |
FROM shops | |
HAVING distance < 25 | |
ORDER BY distance | |
LIMIT 0 , 20; | |
``` |