Update
parent
7f2667417f
commit
f7badceb3d
|
@ -114,7 +114,7 @@ def updateTransmitters():
|
|||
Transmitters[str(x["norad_cat_id"])][x["uuid"]] = [x["description"],"#"+str("%06x" % random.randint(0, 0xFFFFFF))]
|
||||
#print Transmitters
|
||||
|
||||
@scheduler.scheduled_job('interval',minutes=3)
|
||||
@scheduler.scheduled_job('interval',minutes=2)
|
||||
def updatePasses():
|
||||
global Passes
|
||||
global Occuring_sats
|
||||
|
|
Binary file not shown.
|
@ -3,11 +3,13 @@ self.importScripts("satellite.js");
|
|||
norad = ""
|
||||
groundStations = []
|
||||
TLE = []
|
||||
Orbits = []
|
||||
|
||||
onmessage = function(e) {
|
||||
norad = e.data[0]
|
||||
TLE = e.data[1]
|
||||
getStations()
|
||||
getOrbit()
|
||||
}
|
||||
|
||||
setInterval(function(){
|
||||
|
@ -20,17 +22,16 @@ setInterval(function(){
|
|||
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date());
|
||||
var positionEci = positionAndVelocity.position
|
||||
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
|
||||
var longitude = positionGd.longitude
|
||||
var latitude = positionGd.latitude
|
||||
|
||||
var curLat = degress(positionGd.latitude)
|
||||
var curLng = degress(positionGd.longitude)
|
||||
if (groundStations[1] == undefined){
|
||||
groundStations.push([])
|
||||
}
|
||||
|
||||
postMessage([norad,TLE[0],[degress(latitude),degress(longitude)],groundStations[0],groundStations[1]])
|
||||
postMessage([norad,TLE[0],[curLat,curLng],groundStations[0],groundStations[1],Orbits])
|
||||
|
||||
|
||||
}, 500);
|
||||
}, 1000);
|
||||
|
||||
function getStations(){
|
||||
var xhttp = new XMLHttpRequest();
|
||||
|
@ -45,4 +46,19 @@ var xhttp = new XMLHttpRequest();
|
|||
|
||||
function degress (radians) {
|
||||
return radians * 180 / Math.PI;
|
||||
};
|
||||
};
|
||||
|
||||
function getOrbit(){
|
||||
var satrec = self.satellite_js.twoline2satrec(TLE[1],TLE[2]);
|
||||
gmst = self.satellite_js.gstime(new Date());
|
||||
while(Orbits.length < 300){
|
||||
gmst = gmst+0.00833333333
|
||||
if (gmst > 6.28318530718){
|
||||
return
|
||||
}
|
||||
positionAndVelocity = self.satellite_js.propagate(satrec, (new Date() / 1000/60));
|
||||
positionEci = positionAndVelocity.position
|
||||
positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
|
||||
Orbits.push([degress(positionGd.latitude),degress(positionGd.longitude)])
|
||||
}
|
||||
}
|
|
@ -86,6 +86,8 @@ Stations = {}
|
|||
Workers = {}
|
||||
Lines = {}
|
||||
Sats = {}
|
||||
Orbits = {}
|
||||
CurrentOrbit = null
|
||||
|
||||
dataS = null
|
||||
function UpdateMap(e) {
|
||||
|
@ -96,8 +98,11 @@ function UpdateMap(e) {
|
|||
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
|
||||
Sats[norad].update()
|
||||
}else{
|
||||
Sats[norad] = L.marker(satPos,{icon: dark_sat,zIndexOffset:1000}).addTo(mymap);
|
||||
Sats[norad] = L.marker(satPos,{icon: dark_sat,zIndexOffset:1000,title:norad}).addTo(mymap);
|
||||
Sats[norad].norad = norad
|
||||
Sats[norad].on('click',SatClick)
|
||||
Lines[norad] = {}
|
||||
Orbits[String(norad)] = e.data[5]
|
||||
|
||||
|
||||
|
||||
|
@ -188,6 +193,17 @@ $.get("/occuring_sats", function(data, status){
|
|||
|
||||
}, 20000);
|
||||
|
||||
function SatClick(e){
|
||||
if (CurrentOrbit == null){
|
||||
}else{
|
||||
CurrentOrbit.removeFrom(mymap)
|
||||
}
|
||||
|
||||
CurrentOrbit = L.polyline(Orbits[Number(e.target.norad)], {color: 'red'});
|
||||
CurrentOrbit.addTo(mymap)
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue