计算两个地图坐标之间的距离

2016-6-15 liyangweb.com 李杨 PHP

function getDistanceBetweenPointsNew($latitude1, $longitude1, $latitude2, $longitude2) {
    $theta = $longitude1 - $longitude2;
    $miles = (sin(deg2rad($latitude1)) * sin(deg2rad($latitude2))) + (cos(deg2rad($latitude1)) * cos(deg2rad($latitude2)) * cos(deg2rad($theta)));
    $miles = acos($miles);
    $miles = rad2deg($miles);
    $miles = $miles * 60 * 1.1515;
    $feet = $miles * 5280;
    $yards = $feet / 3;
    $kilometers = $miles * 1.609344;
    $meters = $kilometers * 1000;
    return compact('miles','feet','yards','kilometers','meters'); 
}
$point1 = array('lat' => 40.770623, 'long' => -73.964367);
$point2 = array('lat' => 40.758224, 'long' => -73.917404);
$distance = getDistanceBetweenPointsNew($point1['lat'], $point1['long'], $point2['lat'], $point2['long']);
foreach ($distance as $unit => $value) {
    echo $unit.': '.number_format($value,4).'<br />';
}

评论:

sdqk527p
2019-01-11 18:39
<a href="http://www.k3htroya.com/air-jordan-12-deep-royal-bleu-quartz-schuhef">air jordan 12 deep royal bleu quartz</a> <a href="http://www.y7dbpccn.com/nike-lunarglide-6-nero-femminile-gituttio-butye">nike lunarglide 6 nero femminile gituttio</a> <a href="http://www.z9b51ckf.com/air-jordan-31-rojo-butya">air jordan 31 rojo</a> <a href="http://www.vt310g2y.com/nike-air-max-thea-for-bon-march%C3%A9-obuvb">nike air max thea for bon march茅</a> <a href="http://www.dhvwolje.com/nike-air-max-1-obsidian-slate-bl%C3%A5-hvit-scarped">nike air max 1 obsidian slate bl氓 hvit</a> <a href="http://www.v870k5rd.com/mennns-nike-air-max-1-gr%C3%B8nn-gull-schuhef">mennns nike air max 1 gr酶nn gull</a>
sdqk527p http://www.sdqk527p.com/
ovnivape
2019-01-01 00:09
<a href="http://www.malagakizomba.com/air-jordan-melo-m10-blanco-amarillo-scarpeg">air jordan melo m10 blanco amarillo</a> <a href="http://www.maximephilips.com/nike-roshe-run-triangle-jaune-blanc-obuvc">nike roshe run triangle jaune blanc</a> <a href="http://www.praxispusch.com/nike-shox-braun-rot-scarpea">nike shox braun rot</a> <a href="http://www.raiedumacon.com/air-jordan-retro-3-kvinders-r%C3%B8d-gr%C3%A5-schuheb">air jordan retro 3 kvinders r酶d gr氓</a> <a href="http://www.trickyourride.com/nfl-landry-jones-womens-limited-black-jersey-2-jacksonville-jaguars-nike-therma-long-sleeve-nflr">nfl landry jones womens limited black jersey 2 jacksonville jaguars nike therma long sleeve</a> <a href="http://www.usuariobacano.com/trey-burton-womens-limited-navy-blue-jersey-nike-nfl-chicago-bears-rush-vapor-untouchable-80-nflx">trey burton womens limited navy blue jersey nike nfl chicago bears rush vapor untouchable 80</a>
[url=http://www.ovnivape.com/]ovnivape[/url]
yourctt
2018-12-30 17:51
<a href="http://www.theuntoldlost.com/nike-kj-wright-jersey-50-nfl-seattle-seahawks-t-shirt-womens-one-color-ash-nflx">nike kj wright jersey 50 nfl seattle seahawks t shirt womens one color ash</a> <a href="http://www.trueaustinpg.com/vibram-fivefingers-classic-s%C3%B8lv-rosa-kurpesc">vibram fivefingers classic s酶lv rosa</a> <a href="http://www.benchconsult.com/nike-limited-justin-britt-jersey-68-nfl-seattle-seahawks-2017-salute-to-service-womens-olive-camo-nflz">nike limited justin britt jersey 68 nfl seattle seahawks 2017 salute to service womens olive camo</a> <a href="http://www.bobbyburrage.com/nike-tanjun-blu-urine-obuve">nike tanjun blu urine</a> <a href="http://www.bonairecliffs.com/lebron-12-low-arancia-and-blu-scarped">lebron 12 low arancia and blu</a> <a href="http://www.cryptomtge.com/maschio-nike-air-huarache-light-verde-grigio-kurpesb">maschio nike air huarache light verde grigio</a>
yourctt http://www.yourctt.com/

发表评论:

Powered by emlog 冀ICP备13011830号-1