naveed125/geo-distance

在地球上找到两点之间的距离。找到最近的地铁区域。

1.0.2 2017-06-05 06:11 UTC

This package is not auto-updated.

Last update: 2024-09-13 23:23:05 UTC


README

使用经纬度计算地球上两点之间的距离。可以根据距离找到最近的地铁区域。

示例

// 1 Market St. San Francisco, California, USA
$start = array (
  'lat' => 37.793629,
  'long' => -122.394264
);

// Pier 39, San Francisco, California, USA
$end = array (
  'lat' => 37.808868, 
  'long' => -122.409842
);

$gd = new GeoDistance\GeoDistance();
$distance = $gd->distance($start,$end);

echo "Distance between the two points is: {$distance} miles\n";

上面的代码应该输出以下内容

Distance between the two points is: 1.3532202220106