-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
204 lines (154 loc) · 6.08 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GeoServer</title>
<!-- Bootstrap 5.0 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- Openlayers library -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/css/ol.css">
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.5.0/build/ol.js"></script>
<!-- HTML menus -->
<link rel="stylesheet" href="css/menu.css">
<!-- Map Layers -->
<script src="map_utils/mapLayers.js"></script>
<!-- Particle animations -->
<script src="map_utils/animation.js"></script>
<script src="map_utils/ParticleSystem.js"></script>
<!-- HTML templates -->
<script src="html_utils/html_templates.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-KN277ZPE5N"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-KN277ZPE5N');
</script>
<style>
.map, .canvas {
width: 100%;
height: 100%;
position: absolute;
background: #f8f4f0;
}
body { margin: 0; padding: 0; }
</style>
</head>
<body>
<!-- Bootstrap 5.0 and Popper https://getbootstrap.com/docs/5.0/getting-started/introduction/ -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<!-- Open layers map -->
<div id="map" class="map"></div>
<canvas id="animationCanvas" class ="canvas" style="background: none; pointer-events: none;"></canvas>
<!-- Buttons -->
<button class="ol-control ol-unselectable layers-button" id="layersButton">
<img src="img/ol_icon.png" style="max-height: 80%"></img>
</button>
<!-- Panels -->
<nav class="menu menu-horizontal menu-bottom" id="menu-bottom">
</nav>
<nav class="menu menu-vertical menu-right" id="menu-right">
</nav>
<!-- Info html -->
<div id="toprightInfo" style="position: absolute; top: 1.5%; right: 5%; opacity: 90%">
</div>
<!-- Repository link -->
<div class="btn btn-light btn-sm btn-link p-0" style="position: absolute; bottom: 1.5%; left: 1%; opacity: 75%">
<a class="btn btn-sm" style="color: #000" href="https://github.com/BlueNetCat/BlueNetCat.github.io/tree/main/geoportal/" target='_blank' rel='noopener noreferrer'>
Repositori
</a>
</div>
<script>
// Button events
document.getElementById("layersButton").onclick = (e) => {
e.preventDefault();
e.stopPropagation();
// TODO: there is no need to create layer's menu everytime, unless layers are dynamic (adding, removing)
createLayersHTML();
}
var map = new ol.Map({
layers: [
// Baselayer
bathymetryLayer,
graticuleLayer,
riversLayer,
eez12nmLayer,
shorelineLayer,
buoysLayer,
buoysLabelLayer,
webcamLayer,
webcamLabelLayer,
nationalParksLayer,
nationalParksLabelsLayer,
radarsLayer,
radarsLabelLayer,
dischargePointsLayer,
dischargePointsLabelLayer,
weatherStationsLayer,
weatherStationsLabelLayer,
tideGaugesLayer,
tideGaugesLabelLayer,
bluenetcatMembersLayer,
bluenetcatMembersLabelLayer,
riversLabelsLayer,
// Sea Velocity
seaVelocityLayer,
// Animation
seaVelocityEastLayer,
seaVelocityNorthLayer,
// Sea Temperature
surfaceTemperatureLayer,
],
target: 'map',
view: new ol.View({
center: ol.proj.fromLonLat([3,41.5]),
zoom: 6,
maxZoom: 22,
extent: ol.proj.fromLonLat([-28,20]).concat(ol.proj.fromLonLat([40, 50]))
}),
});
start();
// Interaction
map.on('singleclick', function (e) {
let el = document.getElementById("menu-bottom");
el.classList.remove("menu-open")
map.forEachFeatureAtPixel(e.pixel, function (f, layer) {
//console.log(f);
// Continue if the layer is not interesting
let layerName = layer.get("name");
if (layerName == "Shoreline" || layerName == "Rivers" || layerName === undefined)
return;
// Open pop-up
if (!el.classList.contains("menu-open"))
el.classList.add("menu-open");
// Display information
props = f.getProperties();
delete props.geometry;
createFeatureInnerHTML(props, el, layerName);
});
});
// Sea Velocity
let tooltipSeaVelocityValue = [];
map.on('pointermove', function(evt) {
// Sea velocity
if (seaVelocityLayer.getVisible() && !(mySource === undefined)) {
var value = (mySource.getValueAtPixel(evt.pixel, tooltipSeaVelocityValue));
if (value !== undefined){
if (value[0] !== undefined){
let seaVelMag = Math.sqrt(value[0]*value[0] + value[1]*value[1]);
document.getElementById("toprightInfo").innerText = "Sea Velocity: " + seaVelMag.toFixed(2) + " m/s";
} else{
document.getElementById("toprightInfo").innerText = "";
}
} else{
document.getElementById("toprightInfo").innerText = "";
}
} else if (document.getElementById("toprightInfo").innerText.search("Sea Velocity") != -1){
document.getElementById("toprightInfo").innerText = "";
}
});
</script>
</body>
</html>