juliuste / direkt.bahn.guru

All direct long-distance railway connections for cities in and beyond central Europe.
https://direkt.bahn.guru
GNU General Public License v3.0
368 stars 24 forks source link

What do the colours mean? Perhaps you can add a legend #4

Open Wikinaut opened 2 years ago

Wikinaut commented 2 years ago

Looks, as if the colours denote the travel duration in one-hour steps?

mandrasch commented 2 years ago

Hey, just another fan of this tool here. Color coding from source code:

const durationCategoryColour = c => {
    if (c === -1) return '#999' // unknown duration
    if (c === 0) return '#333' // 0
    if (c === 1) return '#191' // < 1h
    if (c === 2) return '#2d1' // 1h-2h
    if (c === 3) return '#d4d411' // 2h-4h
    if (c === 4) return '#d91' // 4h-8h
    if (c === 5) return '#d41' // 8h-16h
    if (c === 6) return '#a41' // > 16h
    return '#999'
}
md42 commented 2 years ago

Does it make sense to show a hint on the map in case this gets asked more often? Had the same question

juliuste commented 2 years ago

Thanks for suggesting this! I'd be happy to have this feature, but AFAIK there are - quite bafflingly - no responsive out-of-the-box libraries for mapbox-gl that one could use here, and I currently don't have too much time to build a legend on my own, even though the task shouldn't take too long. Will look into that in the future, however, and if someone else wants to do so before, I'd also be grateful 🙂

schlomo commented 2 years ago

I think that a "help" or "explanations" or "legend" link in the footer would be just enough, no need for a fancy solution.