Skip to content

Commit aa12dba

Browse files
authored
Adjust speed colour scale (#683)
This adjusts the colour scale of the speed layer with the goal of using a wider range of colours for low speed values. See #668 for more details. <img width="1567" height="619" alt="image" src="https://github.com/user-attachments/assets/6750670a-becb-4378-a071-120cec1bfdcf" />
1 parent 8af707a commit aa12dba

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

proxy/js/styles.mjs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -257,30 +257,19 @@ const speedLegends = [
257257
80,
258258
90,
259259
100,
260-
110,
261260
120,
262-
130,
263261
140,
264-
150,
265262
160,
266-
170,
267263
180,
268-
190,
269264
200,
270-
210,
271265
220,
272-
230,
273266
240,
274-
250,
275267
260,
276-
270,
277268
280,
278-
290,
279269
300,
280270
320,
281271
340,
282-
360,
283-
380
272+
360
284273
];
285274

286275
const gaugeLegends = [
@@ -356,16 +345,16 @@ const train_protection_construction_dasharray = [2, 8];
356345

357346
const minSpeed = 10
358347
const maxSpeed = 380
359-
const startHue = 248
360-
const endHue = 284;
348+
const startHue = 250
349+
const endHue = 275;
361350

362351
const speedColor = ['case',
363352
['==', ['get', 'maxspeed'], null], 'gray',
364353
// Reverse hue order
365-
['concat', 'hsl(', ['%', ['+', ['-', startHue, ['*', startHue + (360 - endHue), ['/', ['-', ['max', minSpeed, ['min', ['get', 'maxspeed'], maxSpeed]], minSpeed], maxSpeed - minSpeed]]], 360], 360], ', 100%, 40%)'],
354+
['concat', 'hsl(', ['%', ['+', ['-', startHue, ['*', startHue + (360 - endHue), ['^', ['/', ['-', ['max', minSpeed, ['min', ['get', 'maxspeed'], maxSpeed]], minSpeed], maxSpeed - minSpeed], 0.63]]], 360], 360], ', 100%, 42%)'],
366355
]
367356
const speedHoverColor = ['case',
368-
['all', ['!=', ['get', 'maxspeed'], null], ['>=', ['get', 'maxspeed'], 260], ['<=', ['get', 'maxspeed'], 300]], colors.hover.alternative,
357+
['all', ['!=', ['get', 'maxspeed'], null], ['>=', ['get', 'maxspeed'], 200], ['<=', ['get', 'maxspeed'], 340]], colors.hover.alternative,
369358
colors.hover.main,
370359
]
371360

0 commit comments

Comments
 (0)