From c3db03d1e35ba327544524b93d1ed145e6cfffb3 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Fri, 11 Jun 2021 12:01:10 +0200 Subject: [PATCH] Keep ele when removing duplicates on concat --- js/control/Export.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/js/control/Export.js b/js/control/Export.js index 5ec4a5e..54904b4 100644 --- a/js/control/Export.js +++ b/js/control/Export.js @@ -284,8 +284,15 @@ BR.Export._concatTotalTrack = function (segments) { let featureCoordinates = feature.geometry.coordinates; if (segmentIndex > 0) { - // remove first segment coordinate, same as previous last - featureCoordinates = featureCoordinates.slice(1); + // remove duplicate coordinate: first segment coordinate same as previous last, + // remove the one without ele value (e.g. beeline) + const prevLast = coordinates[coordinates.length - 1]; + const first = featureCoordinates[0]; + if (prevLast.length < first.length) { + coordinates.pop(); + } else { + featureCoordinates = featureCoordinates.slice(1); + } } coordinates = coordinates.concat(featureCoordinates); }