Add Ascend/Descend when routing with GraphHopper

This commit is contained in:
Nicolas Cornu 2017-02-16 19:35:27 +01:00
parent 80ff26802f
commit 5401055ce1
3 changed files with 12 additions and 3 deletions

View file

@ -207,8 +207,13 @@ OSM.Directions = function (map) {
'<span class="icon close"></span></a>' + I18n.t('javascripts.directions.directions') +
'</h2><p id="routing_summary">' +
I18n.t('javascripts.directions.distance') + ': ' + formatDistance(route.distance) + '. ' +
I18n.t('javascripts.directions.time') + ': ' + formatTime(route.time) + '.</p>' +
'<table id="turnbyturn" />';
I18n.t('javascripts.directions.time') + ': ' + formatTime(route.time) + '.';
if (typeof route.ascend !== 'undefined' && typeof route.descend !== 'undefined') {
html += '<br />' +
I18n.t('javascripts.directions.ascend') + ': ' + Math.round(route.ascend) + 'm. ' +
I18n.t('javascripts.directions.descend') + ': ' + Math.round(route.descend) +'m.';
}
html += '</p><table id="turnbyturn" />';
$('#sidebar_content')
.html(html);

View file

@ -62,7 +62,9 @@ function GraphHopperEngine(id, vehicleType) {
line: line,
steps: steps,
distance: path.distance,
time: path.time / 1000
time: path.time / 1000,
ascend: path.ascend,
descend: path.descend
});
},
error: function () {