No need to convert lat/lon to latitude/longitude for geolib

This commit is contained in:
Mattéo Delabre 2020-07-18 19:00:31 +02:00
父節點 56009e2502
當前提交 4520ce647f
簽署人: matteo
GPG 金鑰 ID: AE3FBD02DC583ABB
共有 1 個檔案被更改,包括 4 行新增9 行删除

查看文件

@ -407,15 +407,10 @@ different sequence of nodes in two or more lines.`);
for (let i = 1; i < points.length; ++i)
{
const len = geolib.getPreciseDistance(
...[points[i - 1], points[i]]
.map(({lat, lon}) => ({
latitude: lat,
longitude: lon
})),
);
points[i].distance = points[i - 1].distance + len;
points[i].distance = geolib.getPreciseDistance(
points[i - 1],
points[i],
) + points[i - 1].distance;
}
}