-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
881 lines (748 loc) · 30.7 KB
/
index.html
File metadata and controls
881 lines (748 loc) · 30.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
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="description" content="New Orleans Flood Analysis" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>New Orleans Flood Analysis</title>
<link rel="icon" type="image/x-icon" href="/img/favicon.ico">
<link rel="stylesheet" href="css/main.css">
<script src="https://unpkg.com/scrollama"></script>
<script
src="https://api.mapbox.com/mapbox-gl-js/v2.8.1/mapbox-gl.js"></script>
</head>
<body>
<!-- Section 1: Site/project introduction -->
<section id="cover"
style="background: url('https://19thnews.org/wp-content/uploads/2021/10/louisiana-hurricane_2jpg.jpg') no-repeat center center; background-size: cover;">
<!-- Project introduction -->
<div id="intro">
<h1>New Orleans Flood Analysis</h1>
<h4>About New Orleans</h4>
<p style="text-align: center;">
New Orleans, Lousianana is without a doubt one of the most famous US cities, known best for
its exuberant carnival season,
specifically it's city-wide celebration of Mardi Gras. But New Orleans
is also famous for another reason: the many tropical hurricanes that
batter the city and more notably, the widespread destruction that can
accompany them.<br><br>New Orleans is located just off of the
Gulf of Mexico, a tropical storm generating body of water. The high winds and low-pressure weather
systems that accompany these storms cause tidal levels to rise and waves
to form, resulting in a phenomena known as storm surge that causes
violent flooding in low elevation coastal areas.<br><br>As a response
to these conditions, New Orleans
has overtime constructed levees surrounding the city to protect from the
rising tides and flooding. Additionally, the city employs 23 pump
stations that pump rainwater runoff and floodwater into the surrounding water bodies.
Unfortunately, this system hasn't always been successful.
</p>
<h4>About the Project</h4>
<p style="text-align: center;">
Using our skills as cartographers, we aim to examine the city and the
risk
posed by future hurricanes to provide a tool for potential damage
mitigation and emergency response development.
With the onset of global warming causing more extreme weather events
around the world, it becomes increasingly important to equip cities like
New Orleans with tools to mitigate and respond to these natural
disasters which may become more frequent and intense with time.
</p>
<!-- Attributions -->
<h5 style="text-align: center;">Team Members</h5>
<div
style="display: flex; flex-direction: row; justify-content: space-between;">
<div id="bio">
<img id="about"
src='https://avatars.githubusercontent.com/u/59899413?v=4' /></img>
<h6>
Ajaz Syed <br><br> Senior in Geography</h6>
</div>
<div id="bio">
<img id="about"
src='https://avatars.githubusercontent.com/u/43830158?v=4' /></img>
<h6>
Maxwell Jayne <br><br> Senior in Geography</h6>
</div>
<div id="bio">
<img id="about"
src='https://avatars.githubusercontent.com/u/59627538?v=4' /></img>
<h6>
Emeka Emeche <br><br> Senior in Geography</h6>
</div>
<div id="bio">
<img id="about"
src='https://avatars.githubusercontent.com/u/102634353?v=4' /></img>
<h6>
Alyssa Havens <br><br> Student in Geography</h6>
</div>
<div id="bio">
<img id="about"
src='https://avatars.githubusercontent.com/u/75300297?v=4' /></img>
<h6>
Lee David <br><br> Senior in Geography</h6>
</div>
</div>
</div>
</section>
<!-- Section 2: Hurricane damage and imagery -->
<section id="damage_section">
<div id="intro2">
<h1>Hurricane Damage</h1>
<div id="chunks">
<p style="font-size: 25px; text-align: center;">Hurricane Katrina (2005)</p>
<p style="font-size: 20px;">
In 2005, the city was hit by Hurricane Katrina, a large
category 3 hurricane. When Katrina made landfall on New Orleans, it
flooded 80% of the city within 24 hours, up to 30 feet above sea level
in some areas, by overtopping levees and subsequently eroding the
ground beneath on the backside. <br>
</p>
<img id="chuck_img" src='img/KatrinaBefore.png'
alt='Hurricane Katrina Before Image' /></img>
<img id="chuck_img" src='img/KatrinaAfter.png'
alt='Hurricane Katrina After Image' /></img>
</div>
<br>
<div id="chunks">
<p style="font-size: 25px; text-align: center;">Hurricane Ida (2021)</p>
<p style="font-size: 20px;">
In 2021, New Orleans was hit by Hurricane Ida, another massive
hurricane similar in nature to Katrina.
And as you can see the damage is similar after 16 years.
These are two
of the most devastating hurricanes that have hit New Orleans, and the
city has been hit by many more, all causing flooding.
</p>
<img id="chuck_img2" src='img/IdaBefore.png'
alt='Hurricane Ida Before Image' /></img>
<img id="chuck_img2" src='img/IdaAfter.png'
alt='Hurricane Ida After Image' /></img>
</div>
<!-- Image attributions -->
<div class="footnote">
<span> Image attribution links <br></span><br>
<a target="_blank"
href="https://weather.com/storms/hurricane/news/2021-08-31-hurricane-ida-aerial-images-before-and-after">Hurricane
Ida Images</a><br>
<a target="_blank"
href="https://globalnews.ca/news/2190704/hurricane-katrina-before-and-after-photos-show-rebuilt-neighbourhoods/">Hurricane
Katrina Images</a>
</div>
</div>
</section>
<!-- Section 3: Gennarrative - A geonarrative has two major components, a storyboard -->
<!-- and a script panel of a series of scenes/actions -->
<section id="geonarrative">
<div id="storyboard">
<!-- create the place holder elements for the menu, map, and legend -->
<nav id="menu"></nav>
<div id="map"></div>
<div class="map-overlay" id="legend"></div>
</div>
<!-- Map scene index 0: Emergency evacuation sites and plan -->
<article class="scene" data-scene="0">
<h2>What happens in an emergency?</h2>
<p>
If a hurricane is near, the city has developed a timeline of steps
to take to help residents evacuate or bunker down and get shelter.
</p>
<img id="items2"
src='http://midcitymessenger.com/wp-content/uploads/2018/05/evacuation-timeline.png'
alt='72-hour Evacuation Timeline' /></img>
<h5>72-hour Evacuation Timeline</h5>
<p>
For the plan, the city has laid out various pick up points and safety
shelters
that can be used for residents to stay in and protect themselves against
the hurricane.
These spots are laid out across the city but majority of them are in
more populated areas.
The two major spots are the Mercedes-Benz Stadium and Smoothie King
Center.
</p>
</article>
<!-- Map scene index 1: Population and income maps -->
<article class="scene" data-scene="1">
<h2>Demographics Comparison</h2>
<h5> Population By Block (2020)</h5>
<p>
We can see that areas along the coast of New Orleans consist of a higher
volume of residents.
This is common in most cities along water. Now the unfortunate part is
that these areas are easier to
be hit since they are along the coast.
</p>
<h5> Average Income By Block (2019)</h5>
<p>
Areas that are south of the coast have a higher income, this might be
because it is safer and nicer.
Whereas areas along the coast, have more people of various incomes,
which make the average less.
</p>
<p>
Areas with a smaller average income, have residents who are less likely
to get up and leave their home
everytime a major hurricane hits the city. These areas should be the
focus for the New Orleans preventative measures.
</p>
</article>
<!-- Map scene index 2: Mapping flood risk to individual plots -->
<article class="scene" data-scene="2">
<h2>Flood Risk</h2>
<h5>Risk Zone Development</h5>
<p>
Before Hurricane Katrina devastated New Orleans, city models estimated flood
levels could reach up to 18 feet (5.5m) above sea level, and afterwards
it was proven they could reach up to 30 feet (9.1m) above. <br>
</p>
<p style="font-size: 14px; padding-right: 2rem;">
<b>Low risk</b> plots
are designated as those above 9m where the highest Katrina floodwaters were unable to touch and likely have not been damaged
due to past flooding, but could be damaged by even larger future storms.
<br> <br>
<b>Moderate</b>
plots lower than 9m above sea level are designated where it has been proven possible flood damage can
occur via Katrina's record flood levels, but is unlikely without a significantly large storm.
<br> <br>
<b>High risk</b>
plots lower than 4m above sea level are designated where it is almost certain that damage will occur if the levees are overtopped, and damage
is likely from typical flooding events.
<br> <br>
<b>Severe risk</b>
plots designated as those within 1m of sea level, where any nearby flooding will cause damage,
even if floodwaters are not able to fully overtop levees.
</p>
</article>
<!-- Map scene index 3: Environment and flood mitigation systems -->
<article class="scene" data-scene="3">
<h2>Current Situation</h2>
<h5>Wetlands Erosion</h5>
<p>
Lousisana, more specifically New Orleans, has seen a lot of beach
erosion as well as wetlands shrinking over the past century. This leads
to additional flooding to the city as it is easier for excess water to
encroach the land and no place to go with limited wetlands.
</p>
<h5>Hurricane Damage Risk Reduction Plan</h5>
<p>
This year, New Orleans completed a $14.5 billion
storm drain risk reduction program. This consists of new floodwalls and
levees, as well as floodgates, surge barriers, and pump stations. This
covers from the east to the west as well as Algiers Canal.
The map shows only a rough outline of the current levees and floodwalls
structure,
but in terms of a solution this is only temporary.
</p>
</article>
</section>
<!-- Section 4: Conclusions -->
<section id="footer">
<h2>Conclusion</h2>
<div id="footer_txt">
<div>
<img id="items"
src='https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/New_Orleans_Elevations.jpg/1920px-New_Orleans_Elevations.jpg' /></img><br>
<div class="footnote3">
<a target="_blank"
href="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/New_Orleans_Elevations.jpg/1920px-New_Orleans_Elevations.jpg">From
Wikimedia</a>
</div>
</div>
<div>
<h2>People may wonder why anyone would build a city on ground that is
below sea level? </h2>
<p>
Initially it wasn't. The sediment carried along the Mississippi river was
deposited into the gulf and over time the sediment piled up and formed a
new land, which is New Orleans. As New Orleans population grew, so did the
demand for land, so engineers made drains to pump out the water in the
swamplands. This dried the land so that people could live on it, but removed
water below the surface which caused air pockets and thus, soil at the
surface began to sink to fill those air pockets, lowering New Orleans
elevation relative to sea level over time.
<br> <br>
The pumps that help New Orleans from filling up with water also take
sediment out of the ground with the water. Normally, the sediment would
continually be replaced by the flooding Mississippi River. However, humans
have stopped the sediment deposit process by:
<br> <br>
1) Building dams upriver that trap sediment<br>
2) Building walls around the river to keep it from flooding and
depositing more sediment.
</p>
</div>
</div>
<p style=" text-align: center; font-size: 20px; margin-top: 3rem; margin-left: 2rem; margin-right: 2rem; ">
To mitigate risk to life in future flood events, New Orleans must continue to pay close
attention to storm forcasts and continually refine it's flood evacuation plan. As water levels rise with
global warming and sediment continues eroding, bringing the city of New Orleans gradually lower, the city
will either need to find a way to gradually raise itself back above sea level such as by importing
additional sediment in future construction, or reduce storm surge intensity by restoring wetlands around
the city to both provide a natural buffer for floodwater and reduce erosion in the region. With the potential for
tropical storms in the region to grow larger and more intense, its unrealistic to rely solely on the levee
system to keep up, even if it is continually made more expansive. <br>
</p>
</section>
<!-- Javascript -->
<script>
// Initialize map, scriptpanel variables
let map, scriptPanel = scrollama();
history.scrollRestoration = "manual";
window.scrollTo(0, 0);
adjustStoryboardlSize();
window.addEventListener("resize", adjustStoryboardlSize);
// Generic window resize listener function: Resizes storyboard script panel based on window dimensions
function adjustStoryboardlSize() {
const scenes = document.getElementsByClassName("scene");
const storyboard = document.getElementById("storyboard");
let sceneH = Math.floor(window.innerHeight * 0.75);
for (const scene of scenes) {
scene.style.height = sceneH + "px";
}
let storyboardHeight = window.innerHeight;
let storyboardMarginTop = (window.innerHeight - storyboardHeight) / 2;
storyboard.style.height = storyboardHeight + "px";
storyboard.style.top = storyboardMarginTop + "px"
scriptPanel.resize();
}
// Mapbox access token
mapboxgl.accessToken =
'pk.eyJ1IjoiYWphemtzeWVkIiwiYSI6ImNrd3plcWVsaTA0azkybm1wZ3c5MnB1OGcifQ.91la4ZENVFAgHfVaXoKjOw';
// Initialize and populate map variable
map = new mapboxgl.Map({
container: 'map', // container ID
style: 'mapbox://styles/mapbox/light-v10',
zoom: 10.77, // starting zoom
minZoom: 3,
maxZoom: 18,
center: [-90.132, 29.994], // starting center: New Orleans, LA
scrollZoom: false,
boxZoom: false,
doubleClickZoom: true
});
map.addControl(new mapboxgl.NavigationControl());
// Expects map variable has been defined
// Loads map data from GeoJSON files
async function geojsonFetch() {
// Capturing geojson map data
let response, population20, income19, evac_spots, leeves;
response = await fetch("assets/income(2019).geojson");
income19 = await response.json();
response = await fetch("assets/levees_lines.geojson");
levees = await response.json();
response = await fetch("assets/population(2020).geojson");
population20 = await response.json();
response = await fetch("assets/evacuation.geojson");
evac_spots = await response.json();
// Adding data sources to map
map.on('load', () => {
map.addSource('income19-src', {
type: 'geojson',
data: income19,
attribution: 'Layer designed by Ajaz Syed'
});
map.addSource('levees-src', {
type: 'geojson',
data: levees,
attribution: 'Layer created and designed by Ajaz Syed'
});
map.addSource('population20-src', {
type: 'geojson',
data: population20,
attribution: 'Layer designed by Ajaz Syed'
});
map.addSource('riskmap-src', {
'type': 'raster',
'tiles': [
'assets/tiles/riskmap_final/{z}/{x}/{y}.png'
],
'tileSize': 256,
'attribution': 'Map tiles designed by Max Jayne'
});
map.loadImage(
'img/shelter_icon.png',
(error, image) => {
if (error) throw error;
map.addImage('custom-marker', image);
// Add a GeoJSON source with 2 points
map.addSource('evac-src', {
type: 'geojson',
data: evac_spots,
attribution: 'Layer created and designed by Ajaz Syed'
});
});
leveeLayer = {
'id': 'levees_points',
'type': 'line',
'source': 'levees-src',
'paint': {
'line-width': 3,
'line-color': ['get', 'color']
}
};
evacLayer = {
'id': 'evac_points',
'type': 'symbol',
'source': 'evac-src',
'layout': {
'icon-image': 'custom-marker',
}
};
population20Layer = {
'id': 'Population',
'type': 'fill',
'source': 'population20-src',
'layout': {
'visibility': 'visible'
},
paint: {
'fill-color': [
'step',
['get', 'population'],
'#ffffb2',
1000,
'#ffd76d',
2000,
'#fea649',
3000,
'#f86c30',
4000,
'#e62f21',
5000,
'#bd0026',
],
'fill-outline-color': '#BBBBBB',
},
};
income19Layer = {
'id': 'Income',
'type': 'fill',
'source': 'income19-src',
'layout': {
'visibility': 'visible'
},
paint: {
'fill-color': [
'step',
['get', 'income'],
'#f7fcf5',
10,
'#ddf2d7',
10000,
'#b2e0ab',
32000,
'#7bc87c',
56000,
'#3da75a',
87000,
'#137e3a',
125000,
'#00441b',
],
'fill-outline-color': '#BBBBBB',
},
};
riskLayer = {
'id': 'risk-plots',
'type': 'raster',
'source': 'riskmap-src'
};
// Initializing script panel
// Storymap 'scene' functionality: Allows for transition between map layers
scriptPanel
.setup({
step: ".scene", // all the scenes.
offset: 0.4, // the location of the enter and exit trigger
debug: false
})
.onStepEnter(handleSceneEnter)
.onStepExit(handleSceneExit);
// Params: Response - object, contains scroll direction, scene index/element items
// Function performs when a scene enters the storyboard
// Changes map zoom and center for each scene, checks for data, and displays current scene map layer
function handleSceneEnter(response) {
var index = response.index; // capture the id of the current scene.
document.getElementById("legend").style.visibility = "hidden";
// Entering the first scene
if (index === 0) {
map.flyTo({
center: [-90.103, 29.971],
zoom: 11.77,
pitch: 0,
});
// Data source checks
if (typeof (map.getSource('evac-src')) == 'undefined') {
map.addSource('evac-src', {
type: 'geojson',
data: evac_spots,
attribution: 'Layer created and designed by Ajaz Syed'
});
} else {
map.getSource('evac-src')
}
// Add layer to map
if (!map.getLayer("evac_points")) { // layer does not exit
map.addLayer(evacLayer);
}
// Hide sections 1 and 2
document.getElementById("damage_section").style.visibility = "hidden";
document.getElementById("cover").style.visibility = "hidden";
// Entering the second scene:
} else if (index === 1) {
map.flyTo({
center: [-90.078, 30.018],
zoom: 10.3,
pitch: 0,
});
// Defining constants for use in map legend
const pop_layers = [
'<1000',
'1000-1999',
'2000-2999',
'3000-3999',
'4000-4999',
'5000+'
];
const pop_colors = [
'#ffffb2',
'#ffd76d',
'#fea649',
'#f86c30',
'#e62f21',
'#bd0026'
];
const inc_layers = [
'No data',
'<$10,000',
'$10,000 - $31,999',
'$32,000 - $55,999',
'$56,000 - $86,999',
'$87,000 - $124,999',
'$125,000+'
];
const inc_colors = [
'#f7fcf5',
'#ddf2d7',
'#b2e0ab',
'#7bc87c',
'#3da75a',
'#137e3a',
'#00441b'
];
// Add layer to map
map.addLayer(population20Layer);
map.addLayer(income19Layer);
document.getElementById("menu").style.visibility = "visible";
if (!map.getLayer('Population') || !map.getLayer('Income')) { // layer exits
return;
}
// Initializing layer toggles
const toggleableLayerIds = ['Population', 'Income'];
// create link for each toggleable layer
for (const id of toggleableLayerIds) {
if (document.getElementById(id)) {
continue;
}
const link = document.createElement('a');
link.id = id;
link.href = '#';
link.textContent = id;
link.className = 'active';
// Show or hide layer when the toggle is clicked.
link.onclick = function (e) {
const clickedLayer = this.textContent;
e.preventDefault();
e.stopPropagation();
// Toggle layer visibility by changing the layout object's visibility property.
const visibility = map.getLayoutProperty(
clickedLayer,
'visibility'
);
if (visibility === 'visible') {
map.setLayoutProperty(clickedLayer, 'visibility', 'none');
this.className = '';
} else {
this.className = 'active';
map.setLayoutProperty(
clickedLayer,
'visibility',
'visible'
);
// Creates map legend for toggled layer
if (clickedLayer == 'Population') {
document.getElementById("legend").style.visibility = "visible";
const legend = document.getElementById("legend");
legend.innerHTML = "<b>Population (2020)</b><br><br>";
pop_layers.forEach((layer, i) => {
const color = pop_colors[i];
const item = document.createElement('div');
const key = document.createElement('span');
key.className = 'legend-key';
key.style.backgroundColor = color;
const value = document.createElement('span');
value.innerHTML = `${layer}`;
item.appendChild(key);
item.appendChild(value);
legend.appendChild(item);
});
} else {
document.getElementById("legend").style.visibility = "visible";
const legend = document.getElementById("legend");
legend.innerHTML = "<b>Average Household Income (2019)</b><br><br>";
inc_layers.forEach((layer, i) => {
const color = inc_colors[i];
const item = document.createElement('div');
const key = document.createElement('span');
key.className = 'legend-key';
key.style.backgroundColor = color;
const value = document.createElement('span');
value.innerHTML = `${layer}`;
item.appendChild(key);
item.appendChild(value);
legend.appendChild(item);
});
}
}
};
// Add toggle element to map
const layers = document.getElementById('menu');
layers.appendChild(link);
}
// Entering the third scene:
} else if (index === 2) {
map.flyTo({
center: [-90.096, 29.992],
zoom: 11.72,
});
// defining colors and labels for flood risk map layer legend
const risk_layers = [
'Severe (<=1m above sea level)',
'High (<=4m above sea level)',
'Moderate (<=9m above sea level)',
'Low (>9m above sea level)'
];
const risk_colors = [
'#ff4901',
'#ffaf01',
'#ffea01',
'#19fe00'
];
// checking map has been populated with relevant map layers
if (typeof (map.getSource('riskmap-src')) == 'undefined') {
map.addSource('riskmap-src', {
type: 'raster',
});
} else {
map.getSource('riskmap-src')
}
if (!map.getLayer("risk-plots")) {
map.addLayer(riskLayer);
}
document.getElementById("legend").style.visibility = "visible";
// defining and building legend for flood risk map layer
const legend = document.getElementById("legend");
legend.innerHTML = "<b>Risk Levels</b><br><br>";
risk_layers.forEach((layer, i) => {
const color = risk_colors[i];
const item = document.createElement('div');
const key = document.createElement('span');
key.className = 'legend-key';
key.style.backgroundColor = color;
const value = document.createElement('span');
value.innerHTML = `${layer}`;
item.appendChild(key);
item.appendChild(value);
legend.appendChild(item);
});
// Entering the fourth scene:
} else if (index === 3) {
map.flyTo({
center: [-90.136, 30.007],
zoom: 10.62,
});
// defining colors and labels for map legend
const layer = [
'Greater New Orleans Hurricane Damage Risk Reduction System',
'Flood walls',
'Sunken Levees',
'Mississippi River Levees'
];
const colors = [
'#FAA916',
'#044167',
'#ED3731',
'#193C16'
];
// data check for relevant map layers
if (typeof (map.getSource('levees-src')) == 'undefined') {
map.addSource('levees-src', {
type: 'geojson',
data: levees,
attribution: 'Layer created and designed by Ajaz Syed'
});
} else {
map.getSource('levees-src')
}
if (!map.getLayer("levees_points")) {
map.addLayer(leveeLayer);
}
// defining and building legend
document.getElementById("legend").style.visibility = "visible";
const legend = document.getElementById("legend");
legend.innerHTML = "<b>Very Rough Outline of New Orleans' Current Levees</b><br><br>";
layer.forEach((layer, i) => {
const color = colors[i];
const item = document.createElement('div');
const key = document.createElement('span');
key.className = 'legend-key';
key.style.backgroundColor = color;
const value = document.createElement('span');
value.innerHTML = `${layer}`;
item.appendChild(key);
item.appendChild(value);
legend.appendChild(item);
});
}
}
// Params: Response - object, contains scroll direction, scene index/element items
// Function performs when a scene exits the storyboard
// Changes visibility for relavant sections and map layers
function handleSceneExit(response) {
var index = response.index;
if (index === 0) {
if (response.direction == 'down') {
document.getElementById("cover").style.visibility = "hidden";
document.getElementById("damage_section").style.visibility = "hidden";
} else {
document.getElementById("cover").style.visibility = "visible";
document.getElementById("damage_section").style.visibility = "visible";
}
if (map.getLayer("evac_points")) {
map.removeLayer('evac_points');
}
} else if (index === 1) {
if (map.getLayer("Population")) {
map.removeLayer('Population');
}
if (map.getLayer("Income")) {
map.removeLayer('Income');
}
document.getElementById("menu").style.visibility = "hidden";
} else if (index === 2) {
if (map.getLayer("risk-plots")) {
map.removeLayer('risk-plots');
}
} else if (index === 3) {
if (map.getLayer("levees_points")) {
map.removeLayer('levees_points');
}
}
}
});
};
geojsonFetch();
</script>
</body>
</html>