From 63fca227ca9ab9e7f269140b828458ab8d09c2be Mon Sep 17 00:00:00 2001 From: Nicolas Cornu Date: Thu, 16 Feb 2017 21:14:17 +0100 Subject: [PATCH] Add line segment to each steps of GraphHopper routing --- app/assets/javascripts/index/directions/graphhopper.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/index/directions/graphhopper.js b/app/assets/javascripts/index/directions/graphhopper.js index 88a9c15c1..267b1b4a6 100644 --- a/app/assets/javascripts/index/directions/graphhopper.js +++ b/app/assets/javascripts/index/directions/graphhopper.js @@ -49,12 +49,16 @@ function GraphHopperEngine(id, vehicleType) { instrText += instr.text; var latLng = line[instr.interval[0]]; var distInMeter = instr.distance; + var lineseg = []; + for (var j = instr.interval[0]; j <= instr.interval[1]; j++) { + lineseg.push({lat: line[j][0], lng: line[j][1]}); + } steps.push([ {lat: latLng.lat, lng: latLng.lng}, instrCode, instrText, distInMeter, - [] + lineseg ]); // TODO does graphhopper map instructions onto line indices? } -- 2.43.2