I'm trying to calculate the distance from a lat, lon using haversine formula. For some reason this only works in the northern hemisphere and I'm suspecting its because of the abs
. Once I remove the absolute value, the code works fine. So I was just wondering what is the purpose of using it?
'(3956 * 2 * ASIN(SQRT( POWER(SIN((' . $latitude . ' - abs(r.latitude)) *
pi()/180 / 2),2) + COS(' . $latitude . ' * pi()/180 ) * COS(abs(r.latitude) *
pi()/180) * POWER(SIN((' . $longitude . '-r.longitude) * pi()/180 / 2), 2) )))
< ' . $radius;