johnsmith153 Posted June 22, 2010 Share Posted June 22, 2010 function distancepcodevalues ($l1, $o1, $l2, $o2)//calculates distance between two lat/long co-ordinates { $l1 = deg2rad ($l1); $sinl1 = sin ($l1); $l2 = deg2rad ($l2); $o1 = deg2rad ($o1); $o2 = deg2rad ($o2); return (7926 - 26 * $sinl1) * asin (min (1, 0.707106781186548 * sqrt ((1 - (sin ($l2) * $sinl1) - cos ($l1) * cos ($l2) * cos ($o2 - $o1))))); } The above function does the job, but is there any way to do this in a MySQL database search (or do I have to dump all db records and then while through them to apply this function)? Link to comment https://forums.phpfreaks.com/topic/205572-calculate-distance-between-2-latitude-longtitude-values/ Share on other sites More sharing options...
kenrbnsn Posted June 22, 2010 Share Posted June 22, 2010 Does this help? Found with this Google Search Ken Link to comment https://forums.phpfreaks.com/topic/205572-calculate-distance-between-2-latitude-longtitude-values/#findComment-1075702 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.