Skip to content

Commit

Permalink
Merge pull request #92 from IGNF/develop
Browse files Browse the repository at this point in the history
Merge develop into master to create a 2.2.2
  • Loading branch information
azarz authored Sep 21, 2023
2 parents 8ef3adf + 9a62f3b commit e11af09
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
14 changes: 7 additions & 7 deletions src/js/sources/pgrSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit e11af09

Please sign in to comment.