I have a set of multiple lng/lat Points where I'm trying to find the one closest to my origin lng/lat. I do not need any distance calculated, only find the point which is the closest to my origin in airdistance.
I need however to take into account if any of the set may be on the other side of the Meridian aswell.
So say I have my current data:
$origin = array( "lat" => 52.3702157, "lng" => 4.8951679 );
$the_rest = array(
array( "lat" => 52.5200066,
"lng" => 13.404954
),
array(
"lat" => 48.856614,
"lng" => 2.3522219
)
);
My initial thought was just to loop through all set and do a simple subtraction of the lat/lng from my origin and see which yeilds the lowest difference. But this does not take into account the Meridian issue.