-
Notifications
You must be signed in to change notification settings - Fork 0
/
weather.html
294 lines (247 loc) · 11.7 KB
/
weather.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
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
<!doctype html>
<!--
Template: Unika - Responsive One Page HTML5 Template
Author: imransdesign.com
URL: http://imransdesign.com/
Designed By: https://www.behance.net/poljakova
Version: 1.0
-->
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Integrated Project 2</title>
<meta name="description" content="Unika - Responsive One Page HTML5 Template">
<meta name="keywords" content="HTML5, Bootsrtrap, One Page, Responsive, Template, Portfolio" />
<meta name="author" content="imransdesign.com">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700,500' rel='stylesheet' type='text/css'> <!-- Body font -->
<link href='https://fonts.googleapis.com/css?family=Lato:300,400' rel='stylesheet' type='text/css'> <!-- Navbar font -->
<!-- Libs and Plugins CSS -->
<link rel="stylesheet" href="inc/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="inc/animations/css/animate.min.css">
<link rel="stylesheet" href="inc/font-awesome/css/font-awesome.min.css"> <!-- Font Icons -->
<link rel="stylesheet" href="inc/owl-carousel/css/owl.carousel.css">
<link rel="stylesheet" href="inc/owl-carousel/css/owl.theme.css">
<!-- Theme CSS -->
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/mobile.css">
<!-- Skin CSS -->
<link rel="stylesheet" href="css/skin/cool-gray.css">
<!-- <link rel="stylesheet" href="css/skin/ice-blue.css"> -->
<!-- <link rel="stylesheet" href="css/skin/summer-orange.css"> -->
<!-- <link rel="stylesheet" href="css/skin/fresh-lime.css"> -->
<!-- <link rel="stylesheet" href="css/skin/night-purple.css"> -->
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<style type="text/css">
.grid-container {
display: grid;
grid-template-columns: 20% 20% 60%;
}
/* .grid-container-left {
padding: 5px 20px;
}
.grid-container-right {
padding: 5px 20px;
}
.grid-container-map {
padding: 5px 20px;
}*/
input {
width: 50px;
}
</style>
</head>
<body data-spy="scroll" data-target="#main-navbar">
<div class="page-loader"></div> <!-- Display loading image while page loads -->
<div class="body">
<!--========== BEGIN HEADER ==========-->
<header id="header" class="header-main">
<!-- Begin Navbar -->
<nav id="main-navbar" class="navbar navbar-default navbar-fixed-top" role="navigation"> <!-- Classes: navbar-default, navbar-inverse, navbar-fixed-top, navbar-fixed-bottom, navbar-transparent. Note: If you use non-transparent navbar, set "height: 98px;" to #header -->
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="index.html">Unika</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a class="page-scroll" href="index.html">Home</a></li>
<li><a class="page-scroll" href="authors.html">Authors</a></li>
<li><a class="page-scroll" href="geojson.html">GeoJSON</a></li>
<li><a class="page-scroll" href="earthquake.html">Earthquake Mapping</a></li>
<li><a class="page-scroll nav-active" href="weather.html">Weather</a></li>
<li><a class="page-scroll " href="additional.html">Additional</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container -->
</nav>
<!-- End Navbar -->
</header>
<!-- ========= END HEADER =========-->
<section class="page parallax" >
<div id="earthquake-content" class="container">
<div class="row">
<div class="col-md-12">
<div class="page-header-wrapper">
<div class="container" style="height:100px">
<div class="page-header text-center wow fadeInDown" data-wow-delay="0.4s">
<h2>Weather Mapping</h2>
<div class="devider"></div>
</div>
</div>
</div>
</div>
</div>
<div id="weatherInfo">
<div style="text-align:center;">
<table>
<!-- Begin weather search by Lat/Long -->
<tr><h5>Search weather</h5></tr>
Latitude:
<input type="number" id="Latitude" style="width: 120px;" >
Longtude:
<input type="number" id="Longtude" style="width: 120px;" >
OR
Location:
<input type="text" id="Location" style="width: 100px;">
<button id="searchButton"> Search </button>
<style>
#searchButton {
background-color: #555555; /* Green */
border: none;
color: white;
padding: 8px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</table>
</div>
<!-- Begin googlemap section -->
<!-- End googlemap section -->
<!-- Begin weather infromation section -->
<br>
<br>
<div class="grid-container">
<div class="grid-container-left">
<img id="condIcon" src="">
<p>Wind</p>
<img id="windIcon" src="">
<p>Speed: <span id="windSpeed"></span> kph</p>
<p>Direction: <span id="windDeg"></span>° <span id="windDir"></span></p>
</div>
<div class="grid-container-right">
<p><span id="condText">Partly Sunny</span></p>
<p><span id="tempC"></span>°C | <span id="tempF"></span>°F</p>
<p>Pressure: <span id="pressure"></span> mbar</p>
<p>Humidity: <span id="humidity"></span></p>
<p>Precipitation: <span id="precipitation"></span> mm</p>
</div>
<div class="grip-container-map">
<div id="map" style="height: 400px"></div>
</div>
</div>
<!-- End weather infromation section -->
</div>
</div>
</section>
<footer class="text-off-white">
<div class="footer">
<div class="container text-center wow fadeIn" data-wow-delay="0.4s">
<p class="copyright">Copyright © 2018 - Developed by Group 4</p>
</div>
</div>
</footer>
<a href="#" class="scrolltotop"><i class="fa fa-arrow-up"></i></a> <!-- Scroll to top button -->
</div><!-- body ends -->
<!-- Plugins JS -->
<script src="inc/jquery/jquery-1.11.1.min.js"></script>
<script src="inc/bootstrap/js/bootstrap.min.js"></script>
<script src="inc/owl-carousel/js/owl.carousel.min.js"></script>
<script src="inc/stellar/js/jquery.stellar.min.js"></script>
<script src="inc/animations/js/wow.min.js"></script>
<script src="inc/waypoints.min.js"></script>
<script src="inc/isotope.pkgd.min.js"></script>
<script src="inc/classie.js"></script>
<script src="inc/jquery.easing.min.js"></script>
<script src="inc/jquery.counterup.min.js"></script>
<script src="inc/smoothscroll.js"></script>
<!-- Theme JS -->
<script src="js/theme.js"></script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCmvWSeWu-g_uQ7TpQBZFspA0KaTnMmdCg&callback=initMap"> </script>
<script type="text/javascript">
$(document).ready(function() {
$('#searchButton').click(function() {
let long = $('#Longtude').val();
let lat = $('#Latitude').val();
let location = $('#Location').val();
let url;
if (location === '')
{
url = `https://api.apixu.com/v1/current.json?key=a656b00b1c1a47158a5163357181112&q=${long},${lat}`;
}
else
{
url = `https://api.apixu.com/v1/current.json?key=a656b00b1c1a47158a5163357181112&q=${location}`;
}
let myLatLng;
$.ajax(url)
.done(function(x){
$('#condIcon').attr('src', 'http:' + x.current.condition.icon);
$('#condText').text(x.current.condition.text);
$('#tempC').text(x.current.temp_c);
$('#tempF').text(x.current.temp_f);
$('#windSpeed').text(x.current.wind_kph);
$('#windDir').text(x.current.wind_dir);
$('#windDeg').text(x.current.wind_degree);
$('#precipitation').text(x.current.precip_mm);
$('#pressure').text(x.current.pressure_mb);
$('#humidity').text(x.current.humidity);
console.log(x.location.lat, x.location.lon);
myLatLng = new google.maps.LatLng(x.location.lat, x.location.lon);
// myLatLng =
// {
// lat: x.location.lat,
// lng: x.location.lon
// };
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: ''
});
map.setCenter(myLatLng);
map.setZoom(5);
});
});
});
let map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: new google.maps.LatLng(2.8, -187.3),
mapTypeId: 'terrain'
});
}
</script>
</body>
</html>