From 900f9252761bb817c573110b933a2e946054f38e Mon Sep 17 00:00:00 2001 From: Henrik Fehlauer Date: Fri, 22 May 2020 18:00:00 +0000 Subject: [PATCH] Improve incline coding visuals and use different colors for going uphill Currently it is a bit difficult to guess the slope of the route for planning purposes, since even for routes in very hilly terrain the colors hardly change. Only extremely steep hills are indicated, and there is no visual difference between going uphill or downhill. By cutting off earlier, more of the route will show meaningful differences in color. Note that BRouter's gradients are already averaged compared to the maximum gradients shown on road signs, so 15% should be a good compromise (anything steeper is difficult to ride on for longer periods anyway, and rightly deserves to be colored with an alarming red). By using different colors for the min and max parameters, uphill and downhill sections should now be easy to distinguish. By introducing two more color stops, the gradient becomes much smoother, with flat sections featuring a distinctive green, where they were drawn in a muddy dark green before. Note that this approach had been implemented like this in QLandkarte GT for several years now, with great success. --- js/plugin/RoutingPathQuality.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/plugin/RoutingPathQuality.js b/js/plugin/RoutingPathQuality.js index 936f481..d1b7944 100644 --- a/js/plugin/RoutingPathQuality.js +++ b/js/plugin/RoutingPathQuality.js @@ -18,12 +18,14 @@ BR.RoutingPathQuality = L.Control.extend({ icon: 'fa-line-chart', provider: new HotLineQualityProvider({ hotlineOptions: { - min: -15, - max: 15, + min: -8.5, + max: 8.5, // angle in degree, == 15% incline palette: { - 0.0: '#ff0000', - 0.5: '#00ff00', - 1.0: '#ff0000' + 0.0: '#0000ff', // blue + 0.25: '#00ffff', // cyan + 0.5: '#00ff00', // green + 0.75: '#ffff00', // yellow + 1.0: '#ff0000' // red }, renderer: renderer },