djtommek / coordinates

WGS84格式坐标的数据对象。

2.0.0 2024-05-20 18:30 UTC

This package is auto-updated.

Last update: 2024-09-20 19:14:44 UTC


README

存储地球上有效坐标的数据对象,格式为十进制WGS-84。

Packagist Version GitHub Repo stars

安装

composer require djtommek/coordinates

使用示例

<?php
$prague = new \DJTommek\Coordinates\Coordinates(50.0875, 14.4213);
printf('Prague: %s', $prague); // Prague: 50.087500,14.421300

$berlin = new \DJTommek\Coordinates\CoordinatesImmutable(52.518611, 13.408333);
$distance = $prague->distance($berlin);

printf('Distance between Prague and Berlin is %d km', $distance / 1000);
// 'Distance between Prague and Berlin is 279 km'

查看源代码以获取更多方法和测试示例。

测试

composer test