nrenner / brouter-web

Web client for BRouter, a routing engine based on OpenStreetMap
https://brouter.de/brouter-web/
MIT License
364 stars 69 forks source link

Common color scheme for Heightgraph and route incline coloring? #361

Open nrenner opened 3 years ago

nrenner commented 3 years ago

From "OSM Android bikerouting" group by Pedro Varela:

The heightgraph looks awesome! Would it be a good idea to apply the colors seen in the Heightgraph to the route incline coloring, so that it would match?

Screenshot

nrenner commented 3 years ago

Incline route coloring was improved in #313 (commit), vs. Heightgraph colors.

rkflx commented 3 years ago

A while ago I calculated which colors to use for the categories so they would match the route color coding:

categories -5 to 5:
#0000ff
#0044ff
#00ddff
#00ffbb
#00ff55
#00ff00
#55ff00
#bbff00
#ffdd00
#ff4400
#ff0000

(Calculation done by linear interpolation for each color channel of the cost color coding gradient, mapped to the midpoint of each height graph color category. Later realized I simply should have used getRGBForValue() from Leaflet.Hotline.)

Sorry there are no screenshots at this point, typing this up from my notes without access to my dev setup.

When applying the newly calculated mappings to the code, you'll notice the graph suddenly looks very different. No more festive colors for flat rides, and irritating behavior for actual hills at the same time. This is not due to choice of color (which works fine for the route color coding), but how categories are setup, i.e. no linear mapping from slope to category at all. Why are there three hugely differing colors going from -1.1% to 1.1%, but no change in color at all going from 10.0% to 15.9%? Is this intuitive for users to grasp at a glance at all, or is all they see "here it goes up, here randomly a bit steeper, here it goes down"?

Now, should we change the height graph to display linear mappings, or the route color coding to employ static categories?

IMO, anything non-linear is hard to communicate to the user, and also more difficult to implement. Still, if research into the topics listed above tells a different story, I'm willing to change my mind. For now I think we should:

Also, there is another problem: The colorization algorithm is not stable in the sense that when reversing a route, the categories and thus colors do not invert only, but change width too in some cases. Seems like the route is not broken into equally sized parts, but instead in parts of a static size with a final part of varying size for the remainder. This can be very misleading, e.g. when switching a route from uphill to downhill suddenly comes out with a totally different color distribution. Sometimes there are even situations where downhill (as defined by map elevation data) is shown on the height graph, while uphill is displayed in the categories (via color + number). (BTW, the route color coding is not perfect either, it sometimes changes colors after zooming. QLandkarteGT does it right, though, might be worth a look...).

(I'll post fixes for some other issues with the height graph in the future, among other things closing those confusing 1% gaps in the wording...)

rucativava commented 1 year ago

Incline route coloring was improved in #313 (commit), vs. Heightgraph colors.

Am I doing something wrong, of the colors of the track on the map and in the height profile do not match at all? See image below:

Screenshot 2023-04-24 at 15 48 48
nrenner commented 1 year ago

We currently have two completely different color schemes, hence this issue. Additionally, the profile aggregates into groups with distinct colors and averages with a buffer, while the track coloring doesn't. This comes from using the independent external plugins Leaflet.Heightgraph and Leaflet.hotline.