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/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", 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(); }