Skip to content

Commit

Permalink
fix(pgr): turf error on some routes (DSR) (#105)
Browse files Browse the repository at this point in the history
* fix(pgr): turf error on some routes (DSR)

* Update pgrSource.js

* Update changelog.md
  • Loading branch information
azarz authored May 16, 2024
1 parent a0c9483 commit 64f43ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
7 changes: 6 additions & 1 deletion src/js/sources/pgrSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 64f43ba

Please sign in to comment.