Getting the value of distance measured and add recommendation

53 Views Asked by At

I am currently trying Tomtom routing with summary example(https://developer.tomtom.com/maps-sdk-web-js/functional-examples#examples,code,routing-with-summary.html). I want to get the result/value of distance (in kilometer) and put it in a conditional statement. Example, if the distance between two points is greater than 20km it will show "Place is too far" but i dont know how to properly do it in js.

I want to add suggestion (result of the condition stement) on the commented part

var detailsHTML =
                '<div class="summary-details-top">Leave now</div>' +
                '<div class="summary-details-bottom">' +
                '<div class="summary-icon-wrapper">' +
                '<span class="tt-icon -car -big"></span>' +
                '</div>' +
                '<div class="summary-details-text">' +
                '<span class="summary-details-info">Distance: <b>' +
                Formatters.formatAsMetricDistance(feature.lengthInMeters) +
                '</b></span>' +
                '<span class="summary-details-info -second">Suggestion: <b>'  // I want to add suggestion here
                '</b></span>' +
                '<span class="summary-details-info -third">Arrive: <b>' +
                Formatters.formatToExpandedDateTimeString(feature.arrivalTime) +
                '</b></span>' +
                '</div>' +
                '</div>';
0

There are 0 best solutions below