From 05cbfa721724f0a36a68c7830bad26fa1f28030c Mon Sep 17 00:00:00 2001 From: "amaury.zarzelli" Date: Thu, 21 Sep 2023 09:26:29 +0200 Subject: [PATCH 1/2] fix(pgrSource): wrong parentheses --- changelog.md | 6 ++++++ src/js/sources/pgrSource.js | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index d3e5b97..99e4781 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # CHANGELOG +## 2.2.2 +FIXED: +- Route requests not working with pgr resources + +## 2.2.1 + FIXED: - Wrong geometry order on pgr results #88 - BBox check not working with negative coordinates #89 diff --git a/src/js/sources/pgrSource.js b/src/js/sources/pgrSource.js index 6f644ff..2efb414 100644 --- a/src/js/sources/pgrSource.js +++ b/src/js/sources/pgrSource.js @@ -792,7 +792,7 @@ module.exports = class pgrSource extends Source { {precision: 6} ).geometry.coordinates; // Reverse geometry order if end point closer to start of geometry than end - if (turf.distance(legStart, turf.point(leg.geometry.coordinates[0]) > turf.distance(legStop, turf.point(leg.geometry.coordinates[0])))) { + if (turf.distance(legStart, turf.point(leg.geometry.coordinates[0])) > turf.distance(legStop, turf.point(leg.geometry.coordinates[0]))) { leg.geometry.coordinates.reverse(); } @@ -918,8 +918,8 @@ module.exports = class pgrSource extends Source { // Reverse geometry order if end point closer to start of geometry than end if ( - turf.distance(stepStart, turf.point(currentPgrRouteStep.geometry.coordinates[0]) > - turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0]))) + turf.distance(stepStart, turf.point(currentPgrRouteStep.geometry.coordinates[0])) > + turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0])) ) { currentPgrRouteStep.geometry.coordinates.reverse(); } @@ -947,8 +947,8 @@ module.exports = class pgrSource extends Source { ).geometry.coordinates; // Reverse geometry order if end point closer to start of geometry than end if ( - turf.distance(stepStart, turf.point(currentPgrRouteStep.geometry.coordinates[0]) > - turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0]))) + turf.distance(stepStart, turf.point(currentPgrRouteStep.geometry.coordinates[0])) > + turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0])) ) { currentPgrRouteStep.geometry.coordinates.reverse(); } @@ -1014,8 +1014,8 @@ module.exports = class pgrSource extends Source { ).geometry.coordinates; // Reverse geometry order if end point closer to start of geometry than end if ( - turf.distance(common_point, turf.point(currentPgrRouteStep.geometry.coordinates[0]) > - turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0]))) + turf.distance(common_point, turf.point(currentPgrRouteStep.geometry.coordinates[0])) > + turf.distance(stepEnd, turf.point(currentPgrRouteStep.geometry.coordinates[0])) ) { currentPgrRouteStep.geometry.coordinates.reverse(); } From 9a62f3bb502371b32c3930339d5c1ed200874fb3 Mon Sep 17 00:00:00 2001 From: Amaury Zarzelli Date: Thu, 21 Sep 2023 09:33:03 +0200 Subject: [PATCH 2/2] Bump package.json to 2.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 144b051..26f0edd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "road2", - "version": "2.2.1", + "version": "2.2.2", "description": "Calcul d'itinéraire", "author": "RDEV - IGN", "main": "src/js/road2.js",