I tried to get distance between 2 coordinates using formula from here
The coordinates is 1.5378236000, 110.3372347000 and 1.5395056000, 110.3373156000.
Somehow the result turn out very different. I believed "dist1" is in KM but not sure about "dist2".
select 6371 * acos( cos( radians(1.5378236000) ) * cos( radians( 1.5395056000 ) ) *
cos( radians( 1.5378236000 ) - radians(110.3373156000) )
+ sin( radians(1.5378236000) ) * sin( radians( 1.5395056000 ) ) ) AS dis1,
GetDistance(1.5378236000, 110.3372347000, 1.5395056000, 110.3373156000) as dis2
Results
dist1: 12091.536526805385
dist2: 0.11190
GetDistance function
CREATE DEFINER=`root`@`localhost` FUNCTION `GetDistance`(
lat1 numeric (9,6),
lon1 numeric (9,6),
lat2 numeric (9,6),
lon2 numeric (9,6)
) RETURNS decimal(10,5)
READS SQL DATA
BEGIN
/* http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe#MySQL */
DECLARE x decimal (20,10);
DECLARE pi decimal (21,20);
SET pi = 3.14159265358979323846;
SET x = sin( lat1 * pi/180 ) * sin( lat2 * pi/180 ) + cos(
lat1 *pi/180 ) * cos( lat2 * pi/180 ) * cos( abs( (lon2 * pi/180) -
(lon1 *pi/180) ) );
SET x = acos( x );
RETURN ( 1.852 * 60.0 * ((x/pi)*180) ) / 1.609344;
END