ivanciric/laracoord

Laravel 5 地理位置距离计算包

安装: 200

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:package

dev-master 2016-12-20 17:36 UTC

This package is auto-updated.

Last update: 2024-09-17 09:04:04 UTC


README

计算地球表面两点之间的距离。

getDistance() 方法

无依赖,只需传递坐标集即可计算地点之间的距离。

安装

"ivanciric/laracoord": "dev-master" 

添加到 composer "require" 数组中。

运行 "composer update"。

现在您可以使用该类

$g = Laracoord::getDistance(
            [
                'lon' => 25.3892,
                'lat' => 35.3172
            ],
            [
                'lon' => 28.3892,
                'lat' => 37.3172
            ],
            'km'
        );

dd($g);

[Screenshot]

相关链接

https://mathworld.net.cn/Haversine.html

http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe#PHP