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))]
|
Transmitters[str(x["norad_cat_id"])][x["uuid"]] = [x["description"],"#"+str("%06x" % random.randint(0, 0xFFFFFF))]
|
||||||
#print Transmitters
|
#print Transmitters
|
||||||
|
|
||||||
@scheduler.scheduled_job('interval',minutes=3)
|
@scheduler.scheduled_job('interval',minutes=2)
|
||||||
def updatePasses():
|
def updatePasses():
|
||||||
global Passes
|
global Passes
|
||||||
global Occuring_sats
|
global Occuring_sats
|
||||||
|
|
Binary file not shown.
|
@ -3,11 +3,13 @@ self.importScripts("satellite.js");
|
||||||
norad = ""
|
norad = ""
|
||||||
groundStations = []
|
groundStations = []
|
||||||
TLE = []
|
TLE = []
|
||||||
|
Orbits = []
|
||||||
|
|
||||||
onmessage = function(e) {
|
onmessage = function(e) {
|
||||||
norad = e.data[0]
|
norad = e.data[0]
|
||||||
TLE = e.data[1]
|
TLE = e.data[1]
|
||||||
getStations()
|
getStations()
|
||||||
|
getOrbit()
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
|
@ -20,17 +22,16 @@ setInterval(function(){
|
||||||
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date());
|
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date());
|
||||||
var positionEci = positionAndVelocity.position
|
var positionEci = positionAndVelocity.position
|
||||||
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
|
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
|
||||||
var longitude = positionGd.longitude
|
var curLat = degress(positionGd.latitude)
|
||||||
var latitude = positionGd.latitude
|
var curLng = degress(positionGd.longitude)
|
||||||
|
|
||||||
if (groundStations[1] == undefined){
|
if (groundStations[1] == undefined){
|
||||||
groundStations.push([])
|
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(){
|
function getStations(){
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
|
@ -45,4 +46,19 @@ var xhttp = new XMLHttpRequest();
|
||||||
|
|
||||||
function degress (radians) {
|
function degress (radians) {
|
||||||
return radians * 180 / Math.PI;
|
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 = {}
|
Workers = {}
|
||||||
Lines = {}
|
Lines = {}
|
||||||
Sats = {}
|
Sats = {}
|
||||||
|
Orbits = {}
|
||||||
|
CurrentOrbit = null
|
||||||
|
|
||||||
dataS = null
|
dataS = null
|
||||||
function UpdateMap(e) {
|
function UpdateMap(e) {
|
||||||
|
@ -96,8 +98,11 @@ function UpdateMap(e) {
|
||||||
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
|
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
|
||||||
Sats[norad].update()
|
Sats[norad].update()
|
||||||
}else{
|
}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] = {}
|
Lines[norad] = {}
|
||||||
|
Orbits[String(norad)] = e.data[5]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -188,6 +193,17 @@ $.get("/occuring_sats", function(data, status){
|
||||||
|
|
||||||
}, 20000);
|
}, 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>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue