com.graphhopper.maps.js.routeManipulation.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of graphhopper-web-bundle Show documentation
Show all versions of graphhopper-web-bundle Show documentation
Use the GraphHopper routing engine as a web-service
var L = require('leaflet');
module.exports.getIntermediatePointIndex = function(routeSegments, clickedLocation) {
// for each point of the route determine its distance to the clicked location and the index
// of the waypoint that comes next if we keep following the route
var nextWayPointIndex = 0;
var wayPoints = routeSegments[0].wayPoints;
var distancesAndNextWayPointIndices = [];
for(var i=0; i 0 && result < wayPoints.length) ? result : 1; //just for safety
return result;
};