From: Nicolas Cornu Date: Thu, 16 Feb 2017 20:14:17 +0000 (+0100) Subject: Add line segment to each steps of GraphHopper routing X-Git-Tag: live~3695^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/63fca227ca9ab9e7f269140b828458ab8d09c2be?ds=sidebyside Add line segment to each steps of GraphHopper routing --- 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? }