team-a/geo

直接和逆向大地测量问题。

1.0.0 2019-06-14 10:14 UTC

This package is auto-updated.

Last update: 2024-09-14 22:24:31 UTC


README

直接和逆向大地测量问题。

该库使用简单的球形模型,而不是大地水准面甚至椭圆体。在这里,误差将在子午线全长的0.06%左右,在赤道半长的0.1%左右。在小段上误差更小,实际上适用于类似物流的任务。

需求

  • php >= 7.1

通过 Composer 安装

composer require team-a/geo:^1.0.0

示例

<?php

use TeamA\Geo;

$Tver      = Geo\Point::create(56.8598, 35.8948);
$SouthPole = Geo\Point::create(-90.0, 0);

$distance = (
    new Geo\Line($Tver, $SouthPole)
)
    ->getDistance()
;

$point2ToSouthPoleLine = Geo\Line::createByBearing($Tver, 90.0, 1000.0);

$initialBearingToSouthPole = $point2ToSouthPoleLine->getInitialBearing();
$finalBearingToSouthPole   = $point2ToSouthPoleLine->getFinalBearing();

$midPoint = $point2ToSouthPoleLine->getMidPoint();