xxxxxxxxxx
35
let latitude = 0;
let longitude = 0;
let map;
async function setup() {
map = L.map("mapId").setView([51.505, -0.09], 1);
L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
attribution:
'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
}).addTo(map);
setInterval(changeWorld, 1000);
}
async function changeWorld() {
const response = await fetch(
"https://api.wheretheiss.at/v1/satellites/25544"
);
let data = await response.json();
latitude = data.latitude;
longitude = data.longitude;
let circle =
latitude &&
longitude &&
L.circle([latitude, longitude], {
color: "red",
fillColor: "#f03",
fillOpacity: 0.5,
radius: 5000,
}).addTo(map);
}
function draw() {}