-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
625 lines (556 loc) · 22.6 KB
/
index.html
File metadata and controls
625 lines (556 loc) · 22.6 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
<!DOCTYPE html>
<html>
<head>
<script src="https://geonb.snb.ca/geonb/ga4.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.head {
background-color:grey;
border: 1px solid black;
height:44px;
width:100%;
}
.title {
background-color:grey;
color:black;
font-size:24px;
height:44px;
vertical-align:center;
float: left;
width: 40%;
}
.toolbar {
content: "";
display: inline-table;
float: right;
}
.toolbar img {
background-color: grey;
border: 1px solid black;
padding: 0px;
cursor: pointer;
float: leftt;
}
.frames {
height:100%;
width: 100%;
border: 2px solid blue;
min-height:100px;
}
.dbframe {
width:50%;
height:100%;
background-color: white;
left:0;
position:fixed;
}
.mapframe {
width: 100%;
height: 100%;
background-color: lightgrey;
right:0;
position:fixed;
}
.esri-popup__main-container.esri-widget {
width: 310px !important;
max-height: 300px !important;
}
</style>
<link href="https://js.arcgis.com/4.10/esri/css/main.css" rel="stylesheet" type="text/css">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script>
<script src="js/vendor/chartjs-plugin-annotation.min.js"></script>
<script src="https://js.arcgis.com/4.10"></script>
<script>
require([
"esri/layers/TileLayer",
"esri/Map",
"esri/Basemap",
"esri/widgets/BasemapToggle",
"esri/views/MapView",
"esri/widgets/CoordinateConversion",
"esri/geometry/Extent",
"esri/geometry/Geometry",
"esri/geometry/Extent",
"esri/tasks/QueryTask",
"esri/Graphic",
"esri/geometry/Point",
"esri/tasks/GeometryService",
"esri/geometry/SpatialReference",
"esri/tasks/support/ProjectParameters",
"esri/layers/GraphicsLayer",
"esri/widgets/BasemapToggle",
"dojo/_base/connect"
], function(TileLayer, Map,
Basemap, BasemapToggle, MapView, CoordinateConversion, Extent, Geometry, Extent, QueryTask, Graphic, Point, GeometryService, SpatialReference, ProjectParameters, GraphicsLayer, BasemapToggle
) {
// Create a WebTileLayer with a third-party cached service
var mapBaseLayer = new TileLayer({
url: "https://geonb.snb.ca/arcgis/rest/services/GeoNB_Basemap_Topo/MapServer",
copyright: "From SNB.",
visible: true
});
geometryService = new GeometryService("https://geonb.snb.ca/arcgis/rest/services/Utilities/Geometry/GeometryServer");
// Create a Basemap with the WebTileLayer. The thumbnailUrl will be used for
// the image in the BasemapToggle widget.
var snbbase = new Basemap({
baseLayers: [mapBaseLayer],
title: "Terrain",
id: "terrain",
thumbnailUrl: "https://geonb.snb.ca/arcgis/rest/services/GeoNB_Basemap_Topo/MapServer/export?bbox=2320000.%2C7360000.%2C2700000.%2C7650000.&bboxSR=&layers=&layerDefs=&size=64,64&imageSR=&format=png&transparent=false&dpi=&time=&layerTimeOptions=&dynamicLayers=&gdbVersion=&mapScale=&f=image"
});
var orlyr = new TileLayer({
url: "https://geonb.snb.ca/arcgis/rest/services/GeoNB_Basemap_Imagery/MapServer",
id: "SNBOrtho",
copyright: "SNB",
visible: true
});
var phbase = new Basemap({
baseLayers: [orlyr],
title: "Photo",
id: "photo",
thumbnailUrl: "https://geonb.snb.ca/arcgis/rest/services/GeoNB_Basemap_Imagery/MapServer/export?bbox=2320000.%2C7360000.%2C2700000.%2C7650000.&bboxSR=&layers=&layerDefs=&size=64,64&imageSR=&format=png&transparent=false&dpi=&time=&layerTimeOptions=&dynamicLayers=&gdbVersion=&mapScale=&f=image"
});
var statLyr = new GraphicsLayer({
id : 'Stations',
title : 'Stations'
});
var map = new Map({
basemap: snbbase
});
map.layers.add(statLyr);
var index = new Extent({
xmin: 2261652,
ymin: 7259455,
xmax: 2827464,
ymax: 7704882,
spatialReference: 2036});
var view = new MapView({
container: "viewDiv",
map: map,
extent: index
// Sets center point of view using longitude,latitude
});
var toggle = new BasemapToggle({
view: view, // view that provides access to the map's 'topo' basemap
nextBasemap: phbase // allows for toggling to the 'hybrid' basemap
});
// Add widget to the top right corner of the view
view.ui.add(toggle, "top-right");
// Get the screen point from the view's click event
//Works for pop-up on mouse over to a station: TODOS --> Add a popup to x, y location when pointer-move event happens
/*
view.on("pointer-move",function (event) {
var screenPoint = {
x: event.x,
y: event.y
};
view.hitTest(screenPoint).then(function (response) {
if (response.results.length) {
var id = makeSlug(response.results[0].graphic.symbol.title);
view.popup.open({
title: id,
location: event.mapPoint
});
}
});
});
*/
view.on("hold",function (event) {
var screenPoint = {
x: event.x,
y: event.y
};
view.hitTest(screenPoint).then(function (response) {
if (response.results.length) {
// var id = makeSlug(response.results[0].graphic.symbol.title);
var id = response.results[0].graphic.symbol.title;
id = id.trim();
view.popup.open({
title: id,
//content = id,
location: event.mapPoint
});
}
});
});
// Get the screen point from the view's click event
view.on("click", function (event) {
var screenPoint = {
x: event.x,
y: event.y
};
view.hitTest(screenPoint).then(function (response) {
if (response.results.length) {
var id = makeSlug(response.results[0].graphic.symbol.title);
$('#'+id).trigger('click');
}
});
});
view.on("key-down", function(event){
//Stop panning if the station dialog is visible.
// Normally, when the left/right arrow keys are pressed, the app moves to the next / previous station.
// This way, the left/rifght arrow keys wont pan the map around when the station dialog is open.
var keyPressed = event.key;
if(keyPressed.slice(0,5) === "Arrow"){
if ( $('body').hasClass('show-station') )
event.stopPropagation();
}
});
function AddStation(lat, lng, inurl, name) {
var outSR = "2036"; // `wkid {number}`
var inputpoint = new Point({
longitude: lng,
latitude: lat
});
var projectParams = new ProjectParameters();
projectParams.geometries = [inputpoint];
//projectParams.outSR = new SpatialReference({ wkid: outSR });
projectParams.outSpatialReference = new SpatialReference({ wkid: outSR });
geometryService.project(projectParams).then(function(result) {
var outputpoint = result[0]; // outputpoint first element of result array
var stat = new Graphic({
geometry: {
type: "point",
x : outputpoint.x,
y : outputpoint.y,
spatialReference: view.spatialReference
},
symbol: {
type: "picture-marker",
url : inurl,
width : '27px',
height: '41px',
yoffset: '15px',
title : name
}
});
statLyr.add(stat);
});
}
view.on("layerview-create" , function(lyr, lvw) {
if(lyr.layer.id == 'Stations') {
initMap(AddStation);
}
});
});
</script>
<title>RWM-SFM</title>
</head>
<body class="en" >
<header id="header">
<h1 class="en">River Watch Mobile<span class="subtitle"> - Water Level Current and Forecast</span></h1>
<h1 class="fr"><span class="widescr">Surveillance</span><span class="nrwscr">Surv.</span> du fleuve mobile<span class="subtitle"> - Niveau des eaux : état actuel et prévisions</span></h1>
<span id="mobile-view" class="dropdown dropdown-right">
<span class="dropdown-title">
<i class="fas fa-chevron-down"></i>
<i class="fas fa-chevron-up"></i>
<span class="en">View</span>
<span class="fr">Vue</span>
</span>
<ul>
<li class="view-list sel" data-view="list">
<span class="en">List</span>
<span class="fr">Liste</span>
</li>
<li class="view-map" data-view="map">
<span class="en">Map</span>
<span class="fr">Carte</span>
</li>
</ul>
</span>
<div id="help-link" class="header-button">
<div class="en">ⓘ Help</div>
<div class="fr">ⓘ Aide</div>
</div>
<div id="lang" class="header-button">
<div class="fr">EN</div>
<div class="en">FR</div>
</div>
</header>
<section id="intro" class="overlay show">
<div class="overlay-content">
<div class="credit">
<img id="nb-logo" class="logo" src="img/nb-logo.png" alt="Government of New Brunswick" />
<span class="en">Flood forecast data is prepared by the Government of New Brunswick</span>
<span class="fr">Les données des prévisions du niveau des eaux proviennent du gouvernement du Nouveau-Brunswick</span>
</div>
<div class="disclaimer">
<div class="en">
<h2>Disclaimer</h2>
<p>No representations or warranties, either express or implied, are made as to the accuracy of the information presented and the user assumes the entire risk as to the use of any and all information.</p>
<p>The information displayed here is current as of the date and time indicated. Updates are provided throughout the spring freshet and other times of the year when high water levels are anticipated. Source data is processed for flood forecasting purposes.</p>
<p>Forecast water levels are dependent on several factors not least of which is weather forecasts, therefore complete accuracy can not be guaranteed. Users of this service are advised to allow for some margin of error.</p>
</div>
<div class="fr">
<h2>Avertissement</h2>
<p>Le Ministère n’offre aucune garantie explicite ou implicite quant à l’exactitude de l’information présentée et l’utilisateur accepte pleinement les risques liés à l’utilisation d’une partie ou de l’ensemble de cette information.</p>
<p>L'information affichée reflète les données actualisées à la date et à l'heure indiquées. Les mises à jour sont fournies pendant la crue printanière et à d'autres moments pendant l'année lorsque des niveaux d'eau élevés sont anticipés. Les données sources sont préparées pour la prévision des inondations.</p>
<p>Les prévisions concernant les niveaux d'eau dépendent d'un certain nombre de facteurs, dont les prévisions météorologiques. Par conséquent, une exactitude absolue des renseignements ne peut être garantie. Les utilisateurs du service sont priés de prévoir une certaine marge d'erreur.</p>
</div>
</div>
<div class="agree">
<span class="en">OK</span>
<span class="fr">OK</span>
</div>
<div class="credit">
<!--<img id="civic-tech-logo" class="logo" src="img/civic-tech-logo.png" alt="Civic Tech Fredericton" />
<span class="en">This app is created and maintained by Civic Tech Fredericton</span>
<span class="fr">Application développée et maintenue par Civic Tech Fredericton</span>
-->
</div>
</div>
</section>
<section id="help" class="overlay">
<div class="overlay-content">
<div class="close">x</div>
<div class="contact">
<div class="en">
<h3>Help</h3>
<ul>
<li>Website: <a href="https://www2.gnb.ca/content/gnb/en/news/public_alerts/river_watch.html" target="_blank">River Watch</a></li>
<li>Twitter: <a href="https://twitter.com/NBEMO_OMUNB" target="_blank">@NBEMO_OMUNB</a></li>
<li>Email: <a href="mailto:Emo22@gnb.ca">Emo22@gnb.ca</a></li>
<li>Telephone: <a href="tel:+18005614034">1-800-561-4034</a></li>
</ul>
<p>Residents can report any issues related to increased water levels or flooding at any time by calling 1-800-561-4034. In case of emergency, call 911.</p>
<ul>
<li>River Watch Mobile application support: <a href="mailto:geonb@snb.ca">geonb@snb.ca</a></li>
</ul>
</div>
<div class="fr">
<h3>Aide</h3>
<ul>
<li>Site web: <a href="https://www2.gnb.ca/content/gnb/fr/nouvelles/alerte/SurveillanceDesCoursDEau.html" target="_blank">Surveillance des cours d’eau</a></li>
<li>Twitter: <a href="https://twitter.com/NBEMO_OMUNB" target="_blank">@NBEMO_OMUNB</a></li>
<li>Courriel: <a href="mailto:Emo22@gnb.ca">Emo22@gnb.ca</a></li>
<li>Téléphone: <a href="tel:+18005614034">1-800-561-4034</a></li>
</ul>
<p>Les résidents peuvent signaler des préoccupations relatives aux inondations et à l’augmentation des niveaux d’eau à n’importe quel moment en composant le 1-800-561-4034. En cas d’urgence, les résidents doivent appeler le 911.</p>
<ul>
<li>Assistance pour l’application de surveillance du fleuve mobile: <a href="mailto:geonb@snb.ca">geonb@snb.ca</a></li>
</ul>
</div>
</div>
<div class="alerts">
<div class="en">
<h3>Alert Level</h3>
<p><span class="normal"></span>Water levels are normal.</p>
<p><span class="advisory"></span>Advisories are issued when conditions are expected to remain below the criteria for warning, but may cause inconvenience or minor disruptions to normal activities. Advisory water level is 2.0 metres below flood stage.</p>
<p><span class="watch"></span>Watch means conditions are favourable for minor disruptions to normal activities. Precautionary steps should be taken to reduce potential loss or damage. Watches are intended to heighten public awareness of the potential impact of events. Watch water level is 1.0 metre below flood stage.</p>
<p><span class="warning"></span>A warning means an event is certain or is IMMINENT. Measures should be taken to safeguard life and property IMMEDIATELY. Warning water level is 0.5 metre below flood.</p>
<p><span class="flood"></span>Water level has reached flood stage at the location indicated. A flood level is the water level when flooding starts to cause significant costs to be incurred.</p>
</div>
<div class="fr">
<h3>Niveau d’alerte</h3>
<p><span class="normal"></span>Le niveau d'eau est normal.</p>
<p><span class="advisory"></span>Un avis indique que les conditions prévues ne devraient pas atteindre les critères du niveau de danger immédiat, mais pourraient tout de même causer des inconvénients ou perturber légèrement les activités habituelles. / Le niveau d’avis est à 2.0 mètres sous le niveau de crue.</p>
<p><span class="watch"></span>Une veille indique que les conditions sont favorables à la perturbation mineure des activités habituelles. Des précautions devraient être prises afin de réduire la perte ou le dommage potentiel. Les veilles ont pour but de sensibiliser le public aux impacts potentiels des événements. Le niveau de veille est à 1.0 mètres sous le niveau de crue.</p>
<p><span class="warning"></span>Un avertissement indique qu’un phénomène météorologique va se produire de manière certaine ou est IMMINENT. Des mesures adéquates doivent donc être prises IMMÉDIATEMENT pour protéger la vie des gens et leurs biens.</p>
<p><span class="flood"></span>Le niveau d’eau a atteint le niveau de crue à l’endroit indiqué. On considère le niveau d’eau comme étant un niveau de crue lorsque cette crue commence à causer des coûts considérables. Le niveau d’avertissement est à 0.5 mètres sous le niveau de crue.</p>
</div>
</div>
</div>
</section>
<nav id="nav">
<div id="my-station">
<div class="nav-controls">
<div class="nav-title">
<span class="en">My Favorite Location</span>
<span class="fr">Mon site préféré</span>
</div>
</div>
<ul id="my-station-list">
</ul>
</div>
<div class="nav-controls">
<div class="nav-title">
<span class="en">All Locations</span>
<span class="fr">Tous les sites</span>
</div>
<div id="nav-sort" class="dropdown">
<span class="dropdown-title">
<i class="fas fa-chevron-down"></i>
<i class="fas fa-chevron-up"></i>
<span class="en">Sort</span>
<span class="fr">Tri</span>
</span>
<ul>
<li class="sort-status" data-sort="status">
<span class="en">Alert Level</span>
<span class="fr">Niveau d’alerte</span>
</li>
<li class="sort-name" data-sort="name">
<span class="en">Alphabetical</span>
<span class="fr">Alphabétique</span>
</li>
<li class="sort-id sel" data-sort="id">
<span class="en">Geographic</span>
<span class="fr">Géographique</span>
</li>
</ul>
</div>
</div>
<ul id="station-list"></ul>
</nav>
<main id="content">
<section id="map">
<div class="mapframe" id="viewDiv"> </div>
</section>
<section id="station-readings" data-id="">
<div id="station-header">
<!-- Stattion Title-->
<div id="station-title"></div>
<!-- Close X -->
<div class="close">x</div>
<hr style="margin-bottom: 0px">
<!-- Real Time Water Level-->
<div>
<a href="" id="near-real-time-wlvl" target="_blank">
<span class="en" style="font-size: 0.8em ; margin-left: 0%; float: right">ⓘ Real-Time Water Level</span>
<span class="fr" style="font-size: 0.8em ; margin-left: 0%; float: right">ⓘ Niveaux d'eau en temps réel</span>
</a>
</div>
<!-- My Favourite Location-->
<div style="color: grey; font-size: 0.8em;">
<input id="choose-station" type="checkbox">
<label for="choose-station" class="en">My Favorite Location</label>
<label for="choose-station" class="fr">Mon site préféré</label>
</div>
<div>
<div id="forecast-notice">
<dl id="forcast-issued">
<dt class="en">Issued</dt>
<dt class="fr">D'émission</dt>
<dd id="date-issued"></dd>
</dl>
<dl id="forcast-next">
<dt class="en">Next Forecast</dt>
<dt class="fr">Prochaine Prévisions</dt>
<dd id="date-next">—</dd>
</div>
</div>
</div>
</div>
<div id="chart-wrapper" ontouchstart="anmo_kai(event);" ontouchend="anmo_wan(event);" >
<canvas id="flood-chart" height="350" width="400"></canvas>
</div>
<hr>
<div id="station-footer">
<div style="width: 20px; float: left;">
ⓘ
</div>
<div id="station-footer-legend">
<div>
<img src="img/measured.png" />
<div class="en">Measured</div>
<div class="fr">Niveau des eaux</div>
</div>
<div>
<img src="img/forecast.png" />
<div class="en">Forecast</div>
<div class="fr">Prévoir</div>
</div>
<div>
<img src="img/advisory.png" />
<div class="en">Advisory</div>
<div class="fr">Avis</div>
</div>
<div>
<img src="img/watch.png" />
<div class="en">Watch</div>
<div class="fr">Veille</div>
</div>
<div>
<img src="img/warning.png" />
<div class="en">Warning</div>
<div class="fr">Avert.</div>
</div>
<div>
<img src="img/flood.png" />
<div class="en">Flood</div>
<div class="fr">Crue</div>
</div>
</div>
</div>
</section>
</main>
<section id="legend" class="legend">
<ul>
<li class=""">ⓘ</li>
<li class="normal"><span class="en">Normal</span><span class="fr">Normal</span></li>
<li class="advisory"><span class="en">Advisory</span><span class="fr">Avis</span> (<span class="advisory-count">0</span>)</li>
<li class="watch"><span class="en">Watch</span><span class="fr">Veille</span> (<span class="watch-count">0</span>)</li>
<li class="warning"><span class="en">Warning</span><span class="fr">Avertissement</span> (<span class="warning-count">0</span>)</li>
<li class="flood"><span class="en">Flood</span><span class="fr">Crue</span> (<span class="flood-count">0</span>)</li>
</ul>
</section>
<footer>
</footer>
<script>
var touchStartX = 0;
var isPiching = false;
var swipeThreshold = 75; // if you moved less than this number then it's a not a swipe
//Record the 'x' location of were the user first touched
function anmo_kai(evt){
if (evt && evt.touches && evt.touches.length > 1)
{
//console.log (' pinch ');
isPiching = true;
}
else
{
isPiching = false;
touchStartX = evt.touches[0].clientX;
//console.log(" start touch ");
}
}
// Determine if the user swiped left or right
function anmo_wan(evt){
//console.log(" ending touch ");
var swipeX = 0; // will hold the distance the user swiped
// Check for a pinch
if (isPiching)
return;
// Verify there are touch events
if (evt && evt.changedTouches)
{
//Compare the X where the first touch was done, when the X location now.
swipeX = evt.changedTouches[0].clientX - touchStartX;
}
if (Math.abs(swipeX) > swipeThreshold) {
if(swipeX < 0) {
//console.log(' Swiped Left - Previous ');
displayPrev();
}
else {
//console.log(' Swiped Right - Next ');
displayNext();
}
}
else {
//console.log(' User did not swipe far enough left or right. Cancelling swipe');
}
}
</script>
<script src="js/vendor/modernizr-3.5.0.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<!-- Google Analytics -->
<script>
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
ga('create','UA-34468740-1','snb.ca');ga('send','pageview')
</script>
<script src="https://www.google-analytics.com/analytics.js" async defer></script>
}
</body>
</html>