cnp/cnp-haversine

获取两个兴趣点之间的距离。

v0.2 2015-12-09 18:24 UTC

This package is auto-updated.

Last update: 2024-09-15 02:41:02 UTC


README

使用Haversine公式计算两个点之间的距离。

用法

$location = new CnpPoi(28.535153, -81.383219);
$destination = new CnpPoi(42.594018, -88.433886)
$location->getDistanceInMilesTo($destination);
$location->getDistanceInMetersTo($destination);

参考

查看 http://rosettacode.org/wiki/Haversine_formula#PHP