Obtain from the coordinates

function get_two_point_distance ($ lat1, $ lat2 , $ lng1, $ lng2) // distance distribution calculation, 
{
$ radLat1 deg2rad = ($ LAT1); // deg2rad () function converts degrees to radians
$ radLat2 = deg2rad ($ lat2) ;
$ radLng1 = deg2rad ($ LNG 1);
$ radLng2 = deg2rad ($ lng2);
$ A = $ radLat1 - $ radLat2;
$ B = $ radLng1 - $ radLng2;
$ S = 2 * ASIN (sqrt (POW (SiN ( A $ / 2), 2) + COS ($ radLat1) * COS ($ radLat2) * POW (SiN ($ B / 2), 2))) * 6378.137;
return round ($ S, 2); // returns a few kilometers
}


doing the shopping site ordering system can take calculated Shipment

Guess you like

Origin www.cnblogs.com/yumingzhao/p/12049062.html