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
parent 56009e2502
commit 4520ce647f
Signed by: matteo
GPG Key ID: AE3FBD02DC583ABB
1 changed files with 4 additions and 9 deletions

View File

@ -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;
}
}