-
Notifications
You must be signed in to change notification settings - Fork 0
/
iss.html
75 lines (72 loc) · 2.58 KB
/
iss.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kimeiga/bahunya/dist/bahunya.min.css">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""></script>
<title>Space Hub</title>
<style>
iframe {
aspect-ratio: 16 / 9;
width: 100% !important;
}
#map { height: 600px; width: 100%; }
</style>
</head>
<body onload="trackISS()">
<header>
<nav>
<ul>
<li><strong>Space Hub</strong></li>
</ul>
<ul>
<li><a href="index.html" class="contrast">APOD</a></li>
<li><a href="epic.html" class="contrast">EPIC</a></li>
<li><a href="iss.html" class="contrast">ISS Tracker</a></li>
</ul>
</nav>
</header>
<main>
<h1>Location of International Space Station</h1>
<div id="map"></div>
</main>
<footer>
<p>Data from <a href = "https://wheretheiss.at/">where the iss at?</a></p>
<br />
<p><a href="https://github.com/vachan-maker/space-hub">Source Code</a></p>
</footer>
<script>
let longitude;
let latitude;
async function trackISS() {
try {
const response = await fetch('https://api.wheretheiss.at/v1/satellites/25544');
if(!response.ok) {
throw new Error("Could not fetch resource");
}
const data = await response.json();
console.log(data);
longitude = data.longitude;
latitude = data.latitude;
var myIcon = L.icon({iconUrl: "assets/space-station.png", iconSize: [38, 95],iconAnchor: [22, 94],popupAnchor: [-3, -76]});
var marker = L.marker([latitude,longitude],{icon: myIcon}).addTo(map);
}
catch (error) {
console.error(error);
}
}
var map = L.map('map').setView([0, 0], 1)
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
</script>
</body>
</html>