PHP計算兩個GPS點之間的距離
Mysql計算兩GPS座標的距離
javascript計算兩個GPS點之間的距離
1 2 3 4 5 111213
#lon為經度,lat為緯度,一定不要弄錯了 |
f lon1, $lat1,$lon2,$lat2 (2*ATAN2(SQRT (SIN(( $lat1-$ )/180 /2) *SIN(7( $lat2)*PI( )/180/2) +$lat2*PI()/ *180)*COS($lat1*PI/ ) *SIN (($ lon1-$lon2) 180/2 ) *SIN(($((0 )*PI( )/ 180/2)), -SIN(($lat1 -$lat2)*PI ()/( *SIN (($lat1-$lat2)* /2) +COS($lat2* )*COS($ lat1*PI()/180) *SIN(( *PI()/180 /2) -$lon2) PI ()/180/2)))) } 呼叫方法:echo distance(39.91917,116.3896,39.91726,116.3940); echo
(39.91917 | 116.3896
;
|