Start adding new veiws
parent
c284032642
commit
827cd3d3dc
|
@ -4,7 +4,7 @@ from flask import Flask , render_template,redirect,url_for
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation
|
from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation ,get_paginated_endpoint
|
||||||
from satellite_tle import fetch_tles
|
from satellite_tle import fetch_tles
|
||||||
|
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
|
@ -32,12 +32,8 @@ def getActive():
|
||||||
start = (datetime.utcnow() - timedelta(0,0,0,0,20)).strftime('%Y-%m-%dT%H:%M:%S%z')
|
start = (datetime.utcnow() - timedelta(0,0,0,0,20)).strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||||
end = (datetime.utcnow() + timedelta(0,0,0,0,30)).strftime('%Y-%m-%dT%H:%M:%S%z')
|
end = (datetime.utcnow() + timedelta(0,0,0,0,30)).strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||||
|
|
||||||
passesR = requests.get("https://network.satnogs.org/api/observations/?end="+end+"&format=json&start="+start)
|
|
||||||
passes = passesR.json()
|
passes = get_paginated_endpoint("https://network.satnogs.org/api/observations/?end="+end+"&format=json&start="+start)
|
||||||
if passesR.links.has_key("next"):
|
|
||||||
while passesR.links.has_key("next"):
|
|
||||||
passesR = requests.get(passesR.links["next"]["url"])
|
|
||||||
passes += passesR.json()
|
|
||||||
ground_stations = {}
|
ground_stations = {}
|
||||||
for x in passes:
|
for x in passes:
|
||||||
if datetime.strptime(x["start"],'%Y-%m-%dT%H:%M:%Sz') > datetime.utcnow() or datetime.strptime(x["end"],'%Y-%m-%dT%H:%M:%Sz') < datetime.utcnow():
|
if datetime.strptime(x["start"],'%Y-%m-%dT%H:%M:%Sz') > datetime.utcnow() or datetime.strptime(x["end"],'%Y-%m-%dT%H:%M:%Sz') < datetime.utcnow():
|
||||||
|
@ -77,11 +73,7 @@ def getActive():
|
||||||
|
|
||||||
|
|
||||||
def GetGroundStations():
|
def GetGroundStations():
|
||||||
stationsR = requests.get("https://network.satnogs.org/api/stations/")
|
stations = get_paginated_endpoint("https://network.satnogs.org/api/stations/?status=2")
|
||||||
stations = stationsR.json()
|
|
||||||
while stationsR.links.has_key("next"):
|
|
||||||
stationsR = requests.get(stationsR.links["next"]["url"])
|
|
||||||
stations += stationsR.json()
|
|
||||||
|
|
||||||
for x in stations:
|
for x in stations:
|
||||||
if x["last_seen"] == None:
|
if x["last_seen"] == None:
|
||||||
|
@ -152,6 +144,10 @@ def updateTLE():
|
||||||
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)))
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
def index():
|
||||||
|
return render_template("index.html")
|
||||||
|
|
||||||
|
|
||||||
@app.route('/active_stations')
|
@app.route('/active_stations')
|
||||||
def api_active_stations():
|
def api_active_stations():
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row"> .
|
||||||
|
<div class="col-md-12">
|
||||||
|
<center>
|
||||||
|
<img src="staic/satnogs-net-logo.png">
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<iframe src = "/static/map/map.html" width="100%" height="100%" ></iframe>
|
||||||
|
|
||||||
|
</center>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,64 @@
|
||||||
|
self.importScripts("satellite.js");
|
||||||
|
|
||||||
|
norad = ""
|
||||||
|
groundStations = []
|
||||||
|
TLE = []
|
||||||
|
Orbits = []
|
||||||
|
|
||||||
|
onmessage = function(e) {
|
||||||
|
norad = e.data[0]
|
||||||
|
TLE = e.data[1]
|
||||||
|
getStations()
|
||||||
|
getOrbit()
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
getStations()
|
||||||
|
}, 20000);
|
||||||
|
|
||||||
|
setInterval(function(){
|
||||||
|
var satrec = self.satellite_js.twoline2satrec(TLE[1],TLE[2]);
|
||||||
|
var gmst = self.satellite_js.gstime(new Date());
|
||||||
|
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date());
|
||||||
|
var positionEci = positionAndVelocity.position
|
||||||
|
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
|
||||||
|
var curLat = degress(positionGd.latitude)
|
||||||
|
var curLng = degress(positionGd.longitude)
|
||||||
|
if (groundStations[1] == undefined){
|
||||||
|
groundStations.push([])
|
||||||
|
}
|
||||||
|
|
||||||
|
postMessage([norad,TLE[0],[curLat,curLng],groundStations[0],groundStations[1],Orbits])
|
||||||
|
|
||||||
|
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
function getStations(){
|
||||||
|
var xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onreadystatechange = function() {
|
||||||
|
if (this.readyState == 4 && this.status == 200) {
|
||||||
|
groundStations = JSON.parse(this.responseText);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhttp.open("GET", "/stations_from_sat/"+norad, true);
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
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)])
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,54 @@
|
||||||
|
<head>
|
||||||
|
<script src="https://cesiumjs.org/releases/1.53/Build/Cesium/Cesium.js"></script>
|
||||||
|
<link href="https://cesiumjs.org/releases/1.53/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
|
||||||
|
<script src="moment.min.js"></script>
|
||||||
|
<script src="satellite.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="cesiumContainer" style="width: 100%; height:100%"></div>
|
||||||
|
<script>
|
||||||
|
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwYmEwOTc5YS01N2I3LTRhYmQtOGE0MS1lNTkyMWU2ZmM3YWUiLCJpZCI6Njg1OCwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0NzU5ODkxOX0.p4alNyuyt_Eufuo8xX_SB6HKHuSixBTxgiVpD6UGI3Y';
|
||||||
|
var viewer = new Cesium.Viewer('cesiumContainer');
|
||||||
|
var satrec = satellite_js.twoline2satrec("1 43017U 17073E 19015.35565251 .00000543 00000-0 48600-4 0 9995","2 43017 97.7201 302.7888 0257714 301.1255 56.4906 14.78360070 62455");
|
||||||
|
getObrit()
|
||||||
|
|
||||||
|
function getObrit(){
|
||||||
|
|
||||||
|
satelliteOrbit = []
|
||||||
|
for (var i = 0; i < 3000; i++){
|
||||||
|
time = moment().add(i*10,"m")
|
||||||
|
var gmst = satellite_js.gstime(new Date(time.valueOf()));
|
||||||
|
var positionAndVelocity = satellite_js.propagate(satrec, new Date(time.valueOf()));
|
||||||
|
var positionEci = positionAndVelocity.position
|
||||||
|
var positionGd = satellite_js.eciToGeodetic(positionEci, gmst)
|
||||||
|
|
||||||
|
satelliteOrbit = satelliteOrbit.concat(Cesium.Ellipsoid.WGS84.cartographicToCartesian(new Cesium.Cartographic(positionGd.longitude, positionGd.latitude, positionGd.height*1000)));
|
||||||
|
}
|
||||||
|
viewer.entities.add({
|
||||||
|
id: 1,
|
||||||
|
name: 'Orbit Polyline',
|
||||||
|
polyline: {
|
||||||
|
positions: satelliteOrbit,
|
||||||
|
width: 5,
|
||||||
|
followSurface: false,
|
||||||
|
material: new Cesium.Material({fabric : { type : 'Color', uniforms : {color : new Cesium.Color(1.0, 1.0, 0.0, 1.0)}}}),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function degress (radians) {
|
||||||
|
return radians * 180 / Math.PI;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -17,25 +17,13 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row"> .
|
|
||||||
<div class="col-md-12">
|
|
||||||
<center>
|
|
||||||
<img src="staic/map/satnogs-net-logo.png">
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
<div id="mapid" ></div>
|
<div id="mapid" ></div>
|
||||||
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
test = null
|
test = null
|
||||||
var light_sat = L.icon({
|
var light_sat = L.icon({
|
||||||
iconUrl: 'staic/map/satellite-marker-light.png',
|
iconUrl: 'satellite-marker-light.png',
|
||||||
iconSize: [40, 40],
|
iconSize: [40, 40],
|
||||||
iconAnchor: [20, 20],
|
iconAnchor: [20, 20],
|
||||||
popupAnchor: [0, 0],
|
popupAnchor: [0, 0],
|
||||||
|
@ -43,7 +31,7 @@ var light_sat = L.icon({
|
||||||
});
|
});
|
||||||
|
|
||||||
var dark_sat = L.icon({
|
var dark_sat = L.icon({
|
||||||
iconUrl: 'staic/map/satellite-marker-dark.png',
|
iconUrl: 'satellite-marker-dark.png',
|
||||||
iconSize: [40, 40],
|
iconSize: [40, 40],
|
||||||
iconAnchor: [20, 20],
|
iconAnchor: [20, 20],
|
||||||
popupAnchor: [0, 0],
|
popupAnchor: [0, 0],
|
||||||
|
@ -51,7 +39,7 @@ var dark_sat = L.icon({
|
||||||
});
|
});
|
||||||
|
|
||||||
var station = L.icon({
|
var station = L.icon({
|
||||||
iconUrl: 'staic/map/station-marker.png',
|
iconUrl: 'station-marker.png',
|
||||||
iconSize: [10, 10],
|
iconSize: [10, 10],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
popupAnchor: [0, 0],
|
popupAnchor: [0, 0],
|
||||||
|
@ -59,7 +47,7 @@ var station = L.icon({
|
||||||
});
|
});
|
||||||
|
|
||||||
var active_station = L.icon({
|
var active_station = L.icon({
|
||||||
iconUrl: 'staic/map/active-station-marker.png',
|
iconUrl: 'active-station-marker.png',
|
||||||
iconSize: [20, 20],
|
iconSize: [20, 20],
|
||||||
iconAnchor: [10, 10],
|
iconAnchor: [10, 10],
|
||||||
popupAnchor: [0, 0],
|
popupAnchor: [0, 0],
|
||||||
|
@ -117,28 +105,18 @@ function UpdateMap(e) {
|
||||||
Sats[norad].bindPopup(popupText)
|
Sats[norad].bindPopup(popupText)
|
||||||
Sats[norad]._popup.setContent(popupText)
|
Sats[norad]._popup.setContent(popupText)
|
||||||
|
|
||||||
temp = []
|
|
||||||
e.data[3].forEach(function(x){
|
|
||||||
temp.push(x[0])
|
|
||||||
})
|
|
||||||
|
|
||||||
e.data[3].forEach(function(x){
|
|
||||||
if (Object.keys(Lines[norad]).includes(String(x[0]))){
|
|
||||||
Object.keys(Lines[norad]).forEach(function(y){
|
|
||||||
Lines[norad][y]._latlngs[1]= {"lat":satPos[0],"lng":satPos[1]}
|
|
||||||
|
|
||||||
})}else{Lines[norad][x[0]] = new L.Polyline([[Stations[x[0]]._latlng.lat,Stations[x[0]]._latlng.lng],[satPos[0],satPos[1]]], {color: x[1],weight: 3,opacity: 1,smoothFactor: 1});
|
|
||||||
Lines[norad][x[0]].addTo(mymap)};
|
|
||||||
})
|
|
||||||
Object.keys(Lines[norad]).forEach(function(x){
|
Object.keys(Lines[norad]).forEach(function(x){
|
||||||
if (temp.includes(Number(x))){
|
|
||||||
|
|
||||||
}else{
|
|
||||||
Lines[norad][x].removeFrom(mymap)
|
Lines[norad][x].removeFrom(mymap)
|
||||||
delete Lines[norad][x]
|
delete Lines[norad][x]
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
e.data[3].forEach(function(x){
|
||||||
|
Lines[norad][x[0]] = new L.Polyline([[Stations[x[0]]._latlng.lat,Stations[x[0]]._latlng.lng],[satPos[0],satPos[1]]], {color: x[1],weight: 3,opacity: 1,smoothFactor: 1});
|
||||||
|
Lines[norad][x[0]].addTo(mymap);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +134,7 @@ function UpdateMap(e) {
|
||||||
$.get("/occuring_sats", function(data, status){
|
$.get("/occuring_sats", function(data, status){
|
||||||
data = JSON.parse(data)
|
data = JSON.parse(data)
|
||||||
Object.keys(data).forEach(function(x){
|
Object.keys(data).forEach(function(x){
|
||||||
worker = new Worker('static/map/Worker.js');
|
worker = new Worker('Worker.js');
|
||||||
worker.onmessage = UpdateMap
|
worker.onmessage = UpdateMap
|
||||||
worker.postMessage([x,data[x]]);
|
worker.postMessage([x,data[x]]);
|
||||||
Workers[x] =worker
|
Workers[x] =worker
|
||||||
|
@ -171,7 +149,7 @@ $.get("/occuring_sats", function(data, status){
|
||||||
Object.keys(data).forEach(function(x){
|
Object.keys(data).forEach(function(x){
|
||||||
if (x in Workers){
|
if (x in Workers){
|
||||||
}else{
|
}else{
|
||||||
worker = new Worker('static/map/Worker.js');
|
worker = new Worker('Worker.js');
|
||||||
worker.onmessage = UpdateMap
|
worker.onmessage = UpdateMap
|
||||||
worker.postMessage([x,data[x]]);
|
worker.postMessage([x,data[x]]);
|
||||||
Workers[x] =worker
|
Workers[x] =worker
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Loading…
Reference in New Issue