Add in changes from the live server :/
parent
0a21df4643
commit
a4dc3721f6
|
@ -115,6 +115,7 @@ def updateStations():
|
||||||
@scheduler.scheduled_job('interval',days=1)
|
@scheduler.scheduled_job('interval',days=1)
|
||||||
def updateTLE():
|
def updateTLE():
|
||||||
print "Updating TLE"
|
print "Updating TLE"
|
||||||
|
global TlEs
|
||||||
sats = fetch_satellites(url=DB_BASE_URL, max_satellites=None)
|
sats = fetch_satellites(url=DB_BASE_URL, max_satellites=None)
|
||||||
satnogs_db_norad_ids = set(sat['norad_cat_id'] for sat in sats if sat['status'] != 're-entered')
|
satnogs_db_norad_ids = set(sat['norad_cat_id'] for sat in sats if sat['status'] != 're-entered')
|
||||||
# Remove satellites with temporary norad ids
|
# Remove satellites with temporary norad ids
|
||||||
|
@ -123,7 +124,7 @@ def updateTLE():
|
||||||
|
|
||||||
# Fetch TLEs for the satellites of interest
|
# Fetch TLEs for the satellites of interest
|
||||||
tles = fetch_tles(satnogs_db_norad_ids)
|
tles = fetch_tles(satnogs_db_norad_ids)
|
||||||
|
TLEs = {}
|
||||||
for norad_id, (source, tle) in tles.items():
|
for norad_id, (source, tle) in tles.items():
|
||||||
TLEs[norad_id] = [str(tle[0]),str(tle[1]),str(tle[2])]
|
TLEs[norad_id] = [str(tle[0]),str(tle[1]),str(tle[2])]
|
||||||
print('\nTLEs for {} of {} requested satellites found ({} satellites with temporary norad ids skipped).'.format(len(tles), len(satnogs_db_norad_ids), len(temporary_norad_ids)))
|
print('\nTLEs for {} of {} requested satellites found ({} satellites with temporary norad ids skipped).'.format(len(tles), len(satnogs_db_norad_ids), len(temporary_norad_ids)))
|
||||||
|
@ -175,6 +176,9 @@ def api_occuring_observations():
|
||||||
def api_occuring_sats():
|
def api_occuring_sats():
|
||||||
obs = {}
|
obs = {}
|
||||||
for x in Passes:
|
for x in Passes:
|
||||||
|
if x.satellite['norad_cat_id'] not in TLEs.keys():
|
||||||
|
q = requests.get("https://db.satnogs.org/satellite_position/"+str( x.satellite['norad_cat_id'])).json()
|
||||||
|
TLEs[ x.satellite['norad_cat_id'] ] = [str(q["name"]),str(q["tle1"]),str(q["tle2"])]
|
||||||
satellite = ephem.readtle(TLEs[x.satellite['norad_cat_id']][0],TLEs[x.satellite['norad_cat_id']][1],TLEs[x.satellite['norad_cat_id']][2])
|
satellite = ephem.readtle(TLEs[x.satellite['norad_cat_id']][0],TLEs[x.satellite['norad_cat_id']][1],TLEs[x.satellite['norad_cat_id']][2])
|
||||||
now = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
|
now = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
|
||||||
satellite.compute(now)
|
satellite.compute(now)
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<center>
|
<center>
|
||||||
<img src="/static/satnogs-net-logo.png">
|
<img src="/static/satnogs-net-logo.png">
|
||||||
<br>
|
|
||||||
<div id="mapid" ></div>
|
<div id="mapid" ></div>
|
||||||
|
|
||||||
</center>
|
</center>
|
||||||
|
@ -86,34 +85,28 @@ links = {}
|
||||||
$.get("/api/satstationpairs", function(data, status){
|
$.get("/api/satstationpairs", function(data, status){
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
data.forEach(function(entry){
|
data.forEach(function(entry){
|
||||||
var 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: 'red',weight: 3,opacity: 1,smoothFactor: 1});
|
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: 'red',weight: 3,opacity: 1,smoothFactor: 1});
|
||||||
firstpolyline.addTo(mymap)
|
firstpolyline.addTo(mymap)
|
||||||
firstpolyline.bringToFront()
|
firstpolyline.bringToFront()
|
||||||
links[entry[1]] = firstpolyline
|
links[entry[1]] = firstpolyline
|
||||||
stationList[entry[0]].setIcon(active_station)
|
stationList[entry[0]].setIcon(active_station)
|
||||||
stationList[entry[0]].setZIndexOffset(500)
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
|
|
||||||
Object.keys(links).forEach(function(key){
|
Object.keys(links).forEach(function(key){
|
||||||
|
links[key].setStyle({opacity:0})
|
||||||
links[key].removeFrom(mymap)
|
links[key].removeFrom(mymap)
|
||||||
|
|
||||||
delete links[key]
|
delete links[key]
|
||||||
})
|
})
|
||||||
|
|
||||||
Object.keys(links).forEach(function(key){
|
|
||||||
|
|
||||||
links[key].removeFrom(mymap)
|
|
||||||
delete links[key]
|
|
||||||
})
|
|
||||||
|
|
||||||
Object.keys(stationList).forEach(function(key){
|
|
||||||
stationList[key].setIcon(station)
|
|
||||||
stationList[key].setZIndexOffset(-1000)
|
|
||||||
|
|
||||||
})
|
|
||||||
$.get("/api/occuringsats", function(data, status){
|
$.get("/api/occuringsats", function(data, status){
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
Object.keys(sats).forEach(function(key){
|
Object.keys(sats).forEach(function(key){
|
||||||
|
@ -123,7 +116,7 @@ setInterval(function(){
|
||||||
|
|
||||||
Object.keys(data).forEach(function(key){
|
Object.keys(data).forEach(function(key){
|
||||||
marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
|
marker = L.marker(data[key]["lat_lng"],{icon: sat,zIndexOffset:1000}).addTo(mymap);
|
||||||
marker.bindPopup("<b>Name: "+data[key]["name"]+"</b>");
|
marker.bindPopup("<b>Name: "+data[key]["name"]+"</b><br><b>Norad: "+key+"</b>");
|
||||||
sats[key] = marker;
|
sats[key] = marker;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -132,16 +125,21 @@ setInterval(function(){
|
||||||
|
|
||||||
$.get("/api/satstationpairs", function(data, status){
|
$.get("/api/satstationpairs", function(data, status){
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
|
var usedStations = []
|
||||||
|
Object.keys(stationList).forEach(function(key){
|
||||||
|
stationList[key].setIcon(station)
|
||||||
|
|
||||||
|
})
|
||||||
data.forEach(function(entry){
|
data.forEach(function(entry){
|
||||||
var 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: 'red',weight:3,opacity:1,smoothFactor: 1});
|
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: 'red',weight:3,opacity:1,smoothFactor: 1});
|
||||||
firstpolyline.addTo(mymap)
|
firstpolyline.addTo(mymap)
|
||||||
links[entry[1]] = firstpolyline
|
links[entry[1]] = firstpolyline
|
||||||
stationList[entry[0]].setIcon(active_station)
|
stationList[entry[0]].setIcon(active_station)
|
||||||
stationList[entry[0]].setZIndexOffset(500)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
console.log(links)
|
console.log(links)
|
||||||
|
|
||||||
}, 60000*2);
|
}, 10000);
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue