检测路径中的故障点

时间:2019-07-12 18:02:26

标签: php coordinates geography

我有一个航点列表(纬度,经度),有时候,该列表中有错误的航点。

example of faulty waypoints

我的问题是:我如何识别那些航路点?

我尝试计算每对航路点的航向,然后将其扔向航向变化太大的地方。

// $heading is the heading of the previous waypoint pair
// $h is the heading of the current waypoint pair

$turn = null;
if ($heading !== null && $h !== null) {
    $a = abs($heading - 180);

    if ($b < 0)
        $b += 360;
    if ($a < 0)
        $a += 360;

    $turn = abs($a - $h);
}

由于仍未检测到一些错误的航路点或错误地检测到了正确的航路点,因此此尝试未成功。

有人知道如何可靠地找出哪些是错误的吗?

编辑: 以下是一些要测试的数据集:

$data = [
    [14.5922222137, -60.9963874817], // First waypoint can't be faulty as it is the start
    [14.58529722, -61.03905556],
    [-23.16040556, 29.58556389], // faulty waypoint
    [14.83583333, -61.30305556],
    [32, -60],
    [51.00166667, -61.99916667],
    [52.66333333, -61.65361111],
    [53.17405278, -60.75461944],
    [53.3191680908, -60.4258346558] // Last waypoint can't be faulty either as it is the end
];

$data2 = [
    [36.0800552368, -115.152252197], // First waypoint can't be faulty as it is the start
    [36.07603889, -115.12513611],
    [36.07641111, -114.99773889],
    [36.07364722, -114.94283889],
    [36.0379, -114.77057222],
    [34.62250278, -107.80684444],
    [34.39397778, -106.69660556],
    [34.36862778, -105.82488333],
    [23.84245, 120.25903611], // faulty
    [29.99604444, -94.30452222],
    [29.66479722, -92.08668333],
    [28.66666667, -88.66666667],
    [24.56361111, -81.01666667],
    [24.45256111, -78.67836944],
    [23.66087778, -77.20931111],
    [15.83413889, -67.49952778],
    [14.24444444, -65.77944444],
    [13.90027778, -64.30277778],
    [14.547, -61.27663889],
    [14.5922222137, -60.9963874817] // Last waypoint can't be faulty either as it is the end
];

0 个答案:

没有答案