added logic to set the correct costing.

This commit is contained in:
Greg Knisely 2018-03-14 13:08:54 -04:00
parent 1fc824acb0
commit 67ad8d94ee

View File

@ -75,10 +75,17 @@ module.exports = function () {
} }
if (this.osrmLoader.method === 'valhalla') { if (this.osrmLoader.method === 'valhalla') {
var val_costing = 'auto';
if (this.profile === 'bicycle')
val_costing = 'bicycle';
else if (this.profile === 'foot')
val_costing = 'pedestrian';
params = { params = {
json: JSON.stringify({ json: JSON.stringify({
locations: waypoints.map(w => {return{ lat: w.lat, lon: w.lon };}), locations: waypoints.map(w => {return{ lat: w.lat, lon: w.lon };}),
costing: 'auto', costing: val_costing,
directions_options:{ directions_options:{
units:'miles'} units:'miles'}
}), }),