Skip to content

Commit 17c6e7f

Browse files
committed
fix(r5): workaround issue with segments being processed multiple times.
1 parent a2d4644 commit 17c6e7f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/plan/r5-to-otp.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ function formatPortion (option, portion) {
9090
}
9191

9292
function formatStreetEdge (streetEdge) {
93-
const line = polyline.decode(streetEdge.geometryPolyline)
94-
streetEdge.geometry = {
95-
points: streetEdge.geometryPolyline,
96-
length: line.length
93+
if (streetEdge.geometry === undefined) {
94+
const line = polyline.decode(streetEdge.geometryPolyline)
95+
streetEdge.geometry = {
96+
points: streetEdge.geometryPolyline,
97+
length: line.length
98+
}
99+
delete streetEdge.geometryPolyline
100+
streetEdge.distance = streetEdge.distance / 1000 // to meters
97101
}
98-
delete streetEdge.geometryPolyline
99-
streetEdge.distance = streetEdge.distance / 1000 // to meters
100102
return streetEdge
101103
}

0 commit comments

Comments
 (0)