From 64f43bab05320e89337ab6f3fc2857ca8cc1110b Mon Sep 17 00:00:00 2001 From: Amaury Zarzelli Date: Thu, 16 May 2024 18:15:07 +0200 Subject: [PATCH] fix(pgr): turf error on some routes (DSR) (#105) * fix(pgr): turf error on some routes (DSR) * Update pgrSource.js * Update changelog.md --- changelog.md | 4 ++++ src/js/sources/pgrSource.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 6d890e1..fda6a48 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.2.6 +FIXED: +- Ignore turf errors for steps simplification in pgrSource, and add a warning to analyse which steps trigger the error + ## 2.2.5 FEAT: diff --git a/src/js/sources/pgrSource.js b/src/js/sources/pgrSource.js index 5670819..00f02e4 100644 --- a/src/js/sources/pgrSource.js +++ b/src/js/sources/pgrSource.js @@ -1028,7 +1028,12 @@ module.exports = class pgrSource extends Source { // On n'enlève les valeurs dupliquées que si la linestring est plus longue que 2 points if (currentPgrRouteStep.geometry.coordinates.length > 2) { - currentPgrRouteStep.geometry.coordinates = turf.cleanCoords(currentPgrRouteStep.geometry).coordinates + try { + currentPgrRouteStep.geometry.coordinates = turf.cleanCoords(currentPgrRouteStep.geometry).coordinates; + } catch(e) { + LOGGER.warn(e); + LOGGER.warn(currentPgrRouteStep); + } } }