-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
149 lines (127 loc) · 4.71 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=\, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="theme-color" content="#0f0f0f">
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
crossorigin=""
/>
<script
src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"
integrity="sha512-QVftwZFqvtRNi0ZyCtsznlKSWOStnDORoefr1enyq5mVL4tmKB3S/EnC3rRJcxCPavG10IcrVGSmPh6Qw5lwrg=="
crossorigin=""
></script>
<script src="https://unpkg.com/@joergdietrich/leaflet.terminator"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap');
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#issMap {
position: absolute;
top: 60px;
bottom: 0;
width: 100%;
}
</style>
<title>What is the current location of ISS? | ISStracker24.com</title>
</head>
<body>
<div style="width: 100%; background-color: #0f0f0f;">
<div align="center">
<h1 style="color:#f0f0f0; font-size: 38px; padding: 12px;">ISStracker<span style="color: lightskyblue;">24</span></h1>
</div>
</div>
<div style="position:relative; z-index:1000;">
<p style="position: absolute; top: 10px; right: 10px; padding:10px; border-radius: 5px; background-color: #f0f0f0;">
latitude: <span id="lat"></span>°<br />
longitude: <span id="lon"></span>° <br />
altitude: <span id="altitude"></span> km <br />
velocity: <span id="velocity"></span> km/h <br />
visibility: <span id="visibility"></span> <br />
</p>
</div>
<div id="issMap"></div>
<script>
const mymap = L.map('issMap').setView([0, 0], 4);
const attribution =
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors | We are NOT associated with <a href="https://flightradar24">flightradar24</a>';
const tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
const tiles = L.tileLayer(tileUrl, { attribution });
var t = L.terminator();
t.addTo(mymap);
setInterval(function(){updateTerminator(t)}, 500);
function updateTerminator(t) {
t.setTime();
}
tiles.addTo(mymap);
const issIcon = L.icon({
iconUrl: 'iss200.png',
iconSize: [70, 52],
iconAnchor: [25, 16]
});
let marker = L.marker([0, 0], { icon: issIcon }).addTo(mymap);
const api_url = 'https://api.wheretheiss.at/v1/satellites/25544';
let firstTime = true;
async function getISS() {
const response = await fetch(api_url);
const data = await response.json();
const { latitude, longitude, altitude, velocity, visibility } = data;
mymap.setView([latitude, longitude], mymap.getZoom());
marker.setLatLng([latitude, longitude]);
document.getElementById('lat').textContent = latitude.toFixed(2);
document.getElementById('lon').textContent = longitude.toFixed(2);
document.getElementById('altitude').textContent = altitude.toFixed(2);
document.getElementById('velocity').textContent = velocity.toFixed(0);
document.getElementById('visibility').textContent = visibility;
}
getISS();
setInterval(getISS, 2500);
</script>
</body>
</html>