-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
525 lines (479 loc) · 17.7 KB
/
index.html
File metadata and controls
525 lines (479 loc) · 17.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bike Sensor Data Visualization</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<link href="manual.css" rel="stylesheet" />
<script src="https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
<script src="https://unpkg.com/pmtiles@3.0.4/dist/pmtiles.js"></script>
<script>
var mapboxgl = maplibregl;
</script>
</head>
<body>
<div id="mapContainer">
<button id="fullscreenBtn" title="Toggle Fullscreen">⛶</button>
<!-- Manual Toggle Button -->
<button id="manualToggleBtn" title="Open User Manual">
📘 Manual
</button>
<!-- Sliding Manual Panel -->
<div id="manualPanel">
<div class="manual-header">
<h3>Cycling Behaviour Dashboard</h3>
<button id="manualCloseBtn" title="Close Manual">✕</button>
</div>
<div class="manual-content">
<section>
<h4>Purpose of the Dashboard</h4>
<p>
This dashboard is designed for officials and urban planners within the
Municipality of Amsterdam to demonstrate the potential of
<strong>cycling-behaviour-informed policy planning</strong>.
</p>
<p>
It combines self-collected cycling sensor data (speed and braking behaviour)
with third-party infrastructure data (road quality and traffic lights).
</p>
<p class="note">
The dataset is so far based on <strong>112 recorded cycling trips</strong>
and should be interpreted as exploratory and illustrative.
</p>
</section>
<section>
<h4>How to Read the Map</h4>
<p>
The map visualises Amsterdam's cycling network using selectable data layers.
Each layer has its own scale, legend, and policy interpretation.
</p>
<p>
White circles indicate locations where no corresponding sensor data is
available for the selected filter.
</p>
</section>
<section>
<h4>Available Data Layers</h4>
<h5>Speed</h5>
<p>
Displays average cycling speed across recorded trips, supporting the
identification of slow or fast corridors.
</p>
<h5>Road Quality</h5>
<p>
Based on third-party infrastructure data, categorised from "Perfect" to
"No road", supporting infrastructure assessment and maintenance planning.
</p>
<h5>Traffic Light Analysis</h5>
<p>
Analyses cyclist behaviour within a 25-metre radius around traffic lights.
</p>
<ul>
<li>
<strong>Safety – Sudden Braking:</strong> detected when cyclists enter the
zone at speeds below 5 km/h, indicating potential safety risks.
</li>
<li>
<strong>Efficiency – Extended Stops:</strong> measured as the percentage
of time spent stopped or nearly stopped (below 2 km/h).
</li>
<li>
<strong>Balanced:</strong> combines both indicators.
</li>
</ul>
<h5>Averaged Road Segments</h5>
<p>
Aggregates speed and road quality into averaged scores per road segment,
supporting corridor-level analysis.
</p>
<h5>Composite Score (Quality + Speed)</h5>
<p>
Combines infrastructure condition and cycling performance into a single
indicator for comparative assessment.
</p>
</section>
<section>
<h4>Using Filters and Interpretations</h4>
<p>
Filters can be activated individually or in combination. Each combination
reflects a deliberate analytical perspective chosen by the user.
</p>
<p>
The dashboard does not prescribe a single interpretation, but supports
exploratory, policy-driven analysis.
</p>
</section>
<section>
<h4>Responsible Use</h4>
<p>
Behavioural indicators should be understood as signals rather than
definitive diagnoses. Results should be interpreted alongside contextual
knowledge of street design, traffic conditions, and policy objectives.
</p>
</section>
</div>
</div>
<div id="map"></div>
<div id="controls">
<h3>Bike Routes</h3>
<div class="control-group">
<label>🔍 Find Trip:</label>
<div class="search-wrapper">
<div class="search-input-row">
<input type="text" id="tripSearchInput" placeholder="e.g., 602CA or 602CA_Trip1" autocomplete="off">
<button id="tripSearchButton">Search</button>
<button id="tripClearButton" style="display:none;">✕</button>
</div>
<ul id="searchSuggestions"></ul>
</div>
</div>
<div class="control-group">
<label class="checkbox-label">
<input type="checkbox" id="speedColorsCheckbox">
Speed
</label>
</div>
<div class="radio-group" id="speedModeGroup">
<label class="radio-label">
<input type="radio" name="speedMode" value="gradient" checked>
Smooth Gradient
</label>
<label class="radio-label">
<input type="radio" name="speedMode" value="categories">
Speed Categories
</label>
</div>
<div class="control-group">
<label class="checkbox-label">
<input type="checkbox" id="roadQualityCheckbox">
Road Quality
</label>
</div>
<div class="control-group">
<label class="checkbox-label">
<input type="checkbox" id="trafficLightsCheckbox">
Traffic Light Analysis
</label>
</div>
<div class="radio-group" id="analysisModeGroup">
<label class="radio-label">
<input type="radio" name="analysisMode" value="safety" checked>
Safety (Sudden Braking)
</label>
<label class="radio-label">
<input type="radio" name="analysisMode" value="efficiency">
Efficiency (Extended Stops)
</label>
<label class="radio-label">
<input type="radio" name="analysisMode" value="overall">
Balanced (Both)
</label>
</div>
<div class="control-group">
<label class="checkbox-label">
<input type="checkbox" id="averagedSegmentsCheckbox">
Averaged Road Segments
</label>
</div>
<div class="radio-group" id="averagedModeGroup">
<label class="radio-label">
<input type="radio" name="averagedMode" value="composite" checked>
Composite Score (Quality + Speed)
</label>
<label class="radio-label">
<input type="radio" name="averagedMode" value="speed">
Average Speed
</label>
<label class="radio-label">
<input type="radio" name="averagedMode" value="quality">
Road Quality
</label>
</div>
<button id="resetButton">↩ Reset View</button>
</div>
<div id="stats">
<h4>Trip Info</h4>
<div class="stat-row" id="statTripRow">
<span class="stat-label">Total trips:</span>
<span class="stat-value" id="statTrips">—</span>
</div>
<div class="stat-row" id="statDistanceRow">
<span class="stat-label">Total distance:</span>
<span class="stat-value" id="statDistance">—</span>
</div>
<div class="stat-row" id="statAvgSpeedRow">
<span class="stat-label">Average speed:</span>
<span class="stat-value" id="statAvgSpeed">—</span>
</div>
<div class="stat-row" id="statTotalTimeRow">
<span class="stat-label">Total time:</span>
<span class="stat-value" id="statTotalTime">—</span>
</div>
<div class="stat-row" id="selectedTripRow">
<span class="stat-label">Selected:</span>
<span class="stat-value" id="selectedTrip">—</span>
</div>
</div>
<div class="legend" id="speedLegend">
<h4>Speed (km/h)</h4>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #808080;"></div>
<span>Stopped (0-2)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>Very Slow (2-5)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>Slow (5-10)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>Moderate (10-15)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>Fast (15-20)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #3B82F6;"></div>
<span>Very Fast (20-25)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #6366F1;"></div>
<span>Extreme (25+)</span>
</div>
</div>
<div class="legend" id="roadQualityLegend">
<h4>Road Quality</h4>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>1 - Perfect</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #84CC16;"></div>
<span>2 - Normal</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>3 - Outdated</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>4 - Bad</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>5 - No road</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #808080;"></div>
<span>Unknown</span>
</div>
</div>
<div class="legend" id="trafficLightLegend">
<h4>Traffic Light Analysis</h4>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #16A34A;"></div>
<span>Excellent+ (0-10)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>Excellent (10-20)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #4ADE80;"></div>
<span>Good+ (20-30)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #84CC16;"></div>
<span>Good (30-40)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FDE047;"></div>
<span>Moderate+ (40-50)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>Moderate (50-60)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FB923C;"></div>
<span>Poor+ (60-70)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>Poor (70-80)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>Critical (80+)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FFFFFF; border: 1px solid #ccc;"></div>
<span>No Data</span>
</div>
</div>
<div class="legend" id="averagedSegmentsLegend">
<h4>Averaged Road Segments</h4>
<!-- Composite Score Legend (default) -->
<div id="compositeLegendItems">
<p class="legend-note">Combined score based on quality and speed</p>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>Excellent (0-20)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #84CC16;"></div>
<span>Good (20-40)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>Moderate (40-60)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>Poor (60-80)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>Critical (80-100)</span>
</div>
</div>
<!-- Speed Legend -->
<div id="avgSpeedLegendItems">
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>Very Slow (0-5 km/h)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>Slow (5-10 km/h)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>Moderate (10-15 km/h)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>Fast (15-20 km/h)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #3B82F6;"></div>
<span>Very Fast (20-25 km/h)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #6366F1;"></div>
<span>Extreme (25+ km/h)</span>
</div>
</div>
<!-- Quality Legend -->
<div id="avgQualityLegendItems">
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #22C55E;"></div>
<span>Perfect (1.0-1.5)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #84CC16;"></div>
<span>Normal (1.5-2.5)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #FACC15;"></div>
<span>Outdated (2.5-3.5)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #F97316;"></div>
<span>Bad (3.5-4.5)</span>
</div>
<div class="speed-legend-item">
<div class="speed-color-box" style="background: #DC2626;"></div>
<span>No Road (4.5-5.0)</span>
</div>
</div>
</div>
</div>
<script>
// Fullscreen functionality
const fullscreenBtn = document.getElementById('fullscreenBtn');
const mapContainer = document.getElementById('mapContainer');
fullscreenBtn.addEventListener('click', () => {
if (!document.fullscreenElement &&
!document.webkitFullscreenElement &&
!document.mozFullScreenElement &&
!document.msFullscreenElement) {
if (mapContainer.requestFullscreen) {
mapContainer.requestFullscreen();
} else if (mapContainer.webkitRequestFullscreen) {
mapContainer.webkitRequestFullscreen();
} else if (mapContainer.mozRequestFullScreen) {
mapContainer.mozRequestFullScreen();
} else if (mapContainer.msRequestFullscreen) {
mapContainer.msRequestFullscreen();
}
fullscreenBtn.textContent = '⛶';
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
fullscreenBtn.textContent = '⛶';
}
});
document.addEventListener('fullscreenchange', updateFullscreenButton);
document.addEventListener('webkitfullscreenchange', updateFullscreenButton);
document.addEventListener('mozfullscreenchange', updateFullscreenButton);
document.addEventListener('MSFullscreenChange', updateFullscreenButton);
function updateFullscreenButton() {
if (document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement) {
fullscreenBtn.textContent = '⛶';
fullscreenBtn.title = 'Exit Fullscreen';
} else {
fullscreenBtn.textContent = '⛶';
fullscreenBtn.title = 'Enter Fullscreen';
}
}
// Manual toggle interaction
const manualPanel = document.getElementById('manualPanel');
const manualToggleBtn = document.getElementById('manualToggleBtn');
const manualCloseBtn = document.getElementById('manualCloseBtn');
manualToggleBtn.addEventListener('click', () => {
manualPanel.classList.toggle('open');
});
manualCloseBtn.addEventListener('click', () => {
manualPanel.classList.remove('open');
});
// Handle legend switching for averaged segments
document.querySelectorAll('input[name="averagedMode"]').forEach(radio => {
radio.addEventListener('change', (e) => {
const mode = e.target.value;
// Hide all legend items
document.getElementById('compositeLegendItems').style.display = 'none';
document.getElementById('avgSpeedLegendItems').style.display = 'none';
document.getElementById('avgQualityLegendItems').style.display = 'none';
// Show relevant legend
if (mode === 'composite') {
document.getElementById('compositeLegendItems').style.display = 'block';
} else if (mode === 'speed') {
document.getElementById('avgSpeedLegendItems').style.display = 'block';
} else if (mode === 'quality') {
document.getElementById('avgQualityLegendItems').style.display = 'block';
}
});
});
</script>
<script type="module" src="config.js"></script>
<script type="module" src="app.js"></script>
</body>
</html>