zackad / normalize-coordinate
此包已被废弃且不再维护。未建议替代包。
规范化经纬度坐标。
v0.1.1
2017-12-29 03:03 UTC
Requires (Dev)
- phpunit/phpunit: ^5.7 || ^6.5
This package is auto-updated.
Last update: 2021-05-19 01:34:51 UTC
README
地理坐标系统(GCS)规范化库,使坐标在以下范围内
-180 < longitude < 180
-90 < latitude < 90
安装
使用composer安装
composer require zackad/normalize-coordinate
用法
use Zackad\GIS\Coordinate\Normalize as Coordinate; $coord = new Coordinate; echo $coord->normalizeLongitude(200); // will output '-160' echo $coord->normalizeLatitude(-200); // will output '20' echo $coord->normalize(541.45, -90.55); // will output '[-178.55, -89.45]'
API
normalize($longitude, $latitude)
: 返回坐标点数组 [x, y] 或 [经度, 纬度]
normalizeLatitude($latitude)
: 返回规范化纬度坐标,范围在 -90 < 纬度 < 90
normalizeLongitude($longitude)
: 返回规范化经度坐标,范围在 -180 < 经度 < 180