diff --git a/templates/map.html b/templates/map.html
index 08397dd..56f5ce2 100644
--- a/templates/map.html
+++ b/templates/map.html
@@ -104,12 +104,12 @@ function UpdateMap(e) {
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
Sats[norad].update()
Object.keys(Lines[norad]).forEach(function(x){
- if (x in .data[3]){
+ if (e.data[3].includes(x)){
Lines[norad][x]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]}
Lines[norad][x].update()
}else{
- Lines[norad][x].removeFrom(mymap)
- delete Lines[norad][x]
+
+
}
})
@@ -134,21 +134,41 @@ function UpdateMap(e) {
worker = new Worker('/static/Worker.js');
worker.onmessage = UpdateMap
worker.postMessage([x,data[x]]);
+ Workers[x] =worker
});
});
- //marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
- //marker.bindPopup("Name: "+data[key]["name"]+"
Norad: "+key+"
Eclipsed?: "+data[key]["eclipsed"]);
- //sats[key] = marker;
-
-
- //lines
- // firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: '#'+entry[1].toString(16).repeat(2).substr(0,6),weight: 3,opacity: 1,smoothFactor: 1});
-
- // firstpolyline.addTo(mymap)
+
+setInterval(function(){
+$.get("/occuring_sats", function(data, status){
+ data = JSON.parse(data)
+ Object.keys(data).forEach(function(x){
+ if (x in Workers){
+ }else{
+ worker = new Worker('/static/Worker.js');
+ worker.onmessage = UpdateMap
+ worker.postMessage([x,data[x]]);
+ Workers[x] =worker
+ }
+ });
+ Object.keys(Workers).forEach(function(x){
+ if (Object.keys(data).includes(x)){
+ }else{
+ Workers[x].terminate()
+ delete Workers[x]
+ UpdateMap({"data":[x,"",[0,0],[]]})
+ Sats[x].removeFrom(mymap)
+ delete Sats[x]
+ delete Lines[x]
+
+ }
+ })
+ });
+}, 20000);
+