djtommek / coordinates
WGS84格式坐标的数据对象。
2.0.0
2024-05-20 18:30 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
README
存储地球上有效坐标的数据对象,格式为十进制WGS-84。
安装
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