I have this query:
select id, post_category_name , title, description,WEIGHT(),
geodist(50.95, 24.69, latitude, longitude) dist
from serv1 where match('@(title,description) searchText ) and dist < 2000000000000;
in my DB post have latitude: 50.85
, and longitude: 24.69
In result I have distance:893641
but real distance is 11119.49
meters.
I also tried convert input coordinates to radians but still have not correct distance.
What I'm doing wrong? Thank you in advance.
Try
geodist(50.95, 24.69, latitude, longitude, {in=deg}) dist
(note {in=deg})
It returns the number close to the one you're expecting:
mysql> select geodist(50.95, 24.69, 50.85, 24.69, {in=deg});
+-----------------------------------------------+
| geodist(50.95, 24.69, 50.85, 24.69, {in=deg}) |
+-----------------------------------------------+
| 11124.928711 |
+-----------------------------------------------+
1 row in set (0.00 sec)