1
0
Fork 0

Add new icon for sat and add colored transmitter lines

merge-requests/2/head
root 2019-02-25 09:19:57 -06:00
parent d9d3c3aa58
commit 2959a35280
18 changed files with 22 additions and 390 deletions

View File

@ -23,6 +23,7 @@ Passes = defaultdict(list)
Stations = []
TLEs = defaultdict(list)
Transmitters = defaultdict(dict)
SatDescrip = defaultdict(str)
CZML = []
def getFuture():
@ -33,7 +34,7 @@ def getFuture():
observations = defaultdict(dict )
start = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S%z')
end = (datetime.utcnow() + timedelta(hours=4,minutes=30)).strftime('%Y-%m-%dT%H:%M:%S%z')
end = (datetime.utcnow() + timedelta(hours=2,minutes=30)).strftime('%Y-%m-%dT%H:%M:%S%z')
passes = get_paginated_endpoint("https://network.satnogs.org/api/jobs/")
obs = get_paginated_endpoint("https://network.satnogs.org/api/observations/?end="+end+"&format=json&start="+start)
@ -96,6 +97,10 @@ def updateTransmitters():
for x in tqdm(temp):
Transmitters[x["norad_cat_id"]][x["uuid"]] = [x["description"],[random.randint(0,255),random.randint(0,255),random.randint(0,255),255]]
for x in Transmitters.keys():
for y in Transmitters[x].keys():
SatDescrip[x] += '<div class="trans" style="background-color:#'+str("%02x" % Transmitters[x][y][1][0])+str("%02x" % Transmitters[x][y][1][1])+str("%02x" % Transmitters[x][y][1][2])+'";>'+Transmitters[x][y][0]+'</div>'
@scheduler.scheduled_job('interval',hours=1)
def updatePasses():
getFuture()
@ -108,6 +113,8 @@ def updateStations():
@scheduler.scheduled_job('interval',minutes=30)
def updateCZML():
global CZML
CZML=[]
doc = {}
doc["id"] = "document"
doc["name"] = "sats"
@ -140,26 +147,28 @@ def updateCZML():
station["position"] = {}
station["point"]["pixelSize"]=7.0
station["position"]["cartographicDegrees"] = [x["lng"],x['lat'],x["altitude"]]
station["description"] = "<b>ID: "+str(x["id"])+"</b><br><b>Total Observations: "+str(x["observations"])+"</b><br><b>Status: "+x["status"]+"</b><br><b>QTH: "+x["qthlocator"]+"</b><br></b>Description: </b>"+x["description"]
station["description"] = "<b>ID: "+str(x["id"])+"</b><br><b>Total Observations: "
station["description"]+=str(x["observations"])+"</b><br><b>Status: "+x["status"]+"</b><br><b>QTH: "
station["description"]+=x["qthlocator"]+"</b><br></b>Description: </b>"+x["description"]
CZML.append(station)
#CZML.append({"point": {"color": {"rgba": [255, 0, 0, 255]}, "pixelSize": 7.0}, "position": {"interpolationDegree": 5, "epoch": "2019-02-20T18:15:31Z", "cartographicRadians": [0, 0.3926577985153905, 1.1691578160879883, 656892.3748016874, 60, 0.3350659338545192, 1.1089605458602834, 655874.386965892, 120, 0.2890197452488876, 1.047837527650023, 654785.5379851013, 180, 0.2509867794693532, 0.9860631482739753, 653641.7898772621, 240, 0.21870672074331488, 0.9238091562480084, 652460.3348020877, 300, 0.19067493892518161, 0.8611882322528641, 651259.3247753858, 360, 0.16585423673939337, 0.7982775055158141, 650057.5822615812, 420, 0.14350728383857447, 0.7351319146596802, 648874.2959984386, 480, 0.12309537649675795, 0.6717921438438812, 647728.7068061114, 540, 0.10421508370803956, 0.60828951924056, 646639.7884730175], "referenceFrame": "INERTIAL", "interpolationAlgorithm": "LAGRANGE"}, "show": True, "id": "485092", "name": "KKS-1 (KISEKI)"})
#return
for x in tqdm(Sats.keys()):
for y in Sats[x]:
sat = {}
sat["id"] = str(y["id"])
sat["name"] = TLEs[x][0]
sat["show"] = True
sat["point"] = {}
sat["point"]["color"] = {}
sat["point"]["color"]["rgba"] = [255,0,0,255]
sat["point"]["pixelSize"]=8.0
#sat["point"] = {}
#sat["point"]["color"] = {}
#sat["point"]["color"]["rgba"] = [255,0,0,255]
#sat["point"]["pixelSize"]=8.0
sat["billboard"] = {"image":"static/sat.png","scale":0.50}
sat["position"] = {}
sat["position"]["cartographicDegrees"]=[]
sat["description"] = SatDescrip[x]
temp = y["start"]
satObj = EarthSatellite(TLEs[x][1],TLEs[x][2],TLEs[x][0])
time = 0
@ -177,13 +186,12 @@ def updateCZML():
sat["position"]["epoch"] = (y["start"].isoformat()+"Z").replace("+00:00","")
sat["path"] = {"show":{"interval":(y["start"].isoformat()+"Z").replace("+00:00","")+"/"+((y["end"]+timedelta(minutes=1)).isoformat()+"Z").replace("+00:00",""),"boolean":True},"width":2,"material":{"solidColor":{"color":{"rgba":[0,255,0,255]}}},"leadTime":100000,"trailTime":100000 }
##sat["label"] = {"show":{"interval":(y["start"].isoformat()+"Z").replace("+00:00","")+"/"+((y["end"]+timedelta(minutes=1)).isoformat()+"Z").replace("+00:00",""),"boolean":True},"horizontalOrigin":"LEFT","font":"12px sans-serif","text":TLEs[x][0]}
CZML.append(sat)
for x in tqdm(Sats.keys()):
for y in Sats[x]:
sat = {}
sat["id"] = str(y["id"])+"Link"
sat["polyline"] = {"show":{"interval":(y["start"].isoformat()+"Z").replace("+00:00","")+"/"+((y["end"]+timedelta(minutes=1)).isoformat()+"Z").replace("+00:00",""),"boolean":True},"width":3,"material":{"solidColor":{"color":{"rgba":[255,0,0,255]}}},"followSurface":False,"positions":{"references":[str(y["id"])+"#position",str(y["station"])+"#position"]}}
sat["polyline"] = {"show":{"interval":(y["start"].isoformat()+"Z").replace("+00:00","")+"/"+((y["end"]+timedelta(minutes=1)).isoformat()+"Z").replace("+00:00",""),"boolean":True},"width":2,"material":{"solidColor":{"color":{"rgba":y["transmitter"][1]}}},"followSurface":False,"positions":{"references":[str(y["id"])+"#position",str(y["station"])+"#position"]}}
CZML.append(sat)
@ -223,4 +231,4 @@ updateCZML()
#updateTLE()
#updatePasses()
scheduler.start()
app.run(use_reloader=False,host = "0.0.0.0",port=5001)
app.run(use_reloader=False,host = "0.0.0.0",port=5001)

Binary file not shown.

View File

@ -1,73 +0,0 @@
self.importScripts("satellite.js");
self.importScripts("moment.min.js");
self.importScripts("https://cesiumjs.org/releases/1.53/Build/Cesium/Cesium.js")
norad = ""
groundStations = []
satrec = null
Orbits = []
name = ""
onmessage = function(e) {
norad = e.data[0]
name = e.data[1][0]
satrec = self.satellite_js.twoline2satrec(e.data[1][1],e.data[1][2]);
getStations()
Orbits = getObrit()
}
setInterval(function(){
getStations()
}, 10000);
setInterval(function(){
getObrit()
}, 60000*5);
setInterval(function(){
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)
if (groundStations[1] == undefined){
groundStations.push([])
}
postMessage([norad,name,self.Cesium.Ellipsoid.WGS84.cartographicToCartesian(new self.Cesium.Cartographic(positionGd.longitude, positionGd.latitude, (positionGd.height*1000))),groundStations[0],groundStations[1],Orbits])
}, 10000);
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 getObrit(){
satelliteOrbit = []
for (var i = 0; i < 30; i++){
time = moment().subtract(10,"m").add(i*1,"m")
var gmst = self.satellite_js.gstime(new Date(time.valueOf()));
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date(time.valueOf()));
var positionEci = positionAndVelocity.position
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
satelliteOrbit = satelliteOrbit.concat(self.Cesium.Ellipsoid.WGS84.cartographicToCartesian(new self.Cesium.Cartographic(positionGd.longitude, positionGd.latitude, positionGd.height*1000)));
}
return satelliteOrbit
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,189 +1 @@
<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="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<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',{timeline:false,vrButton:false,homeButton:false,animation:false,baseLayerPicker:true});
viewer.terrainProvider = Cesium.createWorldTerrain();
Orbits = {}
Satelites = {}
Workers = {}
Stations = {}
Lines = {}
$.get("/active_stations", function(data, status){
data = JSON.parse(data)
dataS = data
data.forEach(function(x){
description = "<b>ID: "+x["id"]+"</b><br><b>Total Observations: "+x["total_obs"]+"</b><br><b>Status: "+x["type"]+"</b><br><b>QTH: "+x["qthlocator"]+"</b><br></b>Description: </b>"+x["description"]
Color = Cesium.Color.GREEN
if(x["type"]=="Testing"){
Color = Cesium.Color.ORANGE
}
Stations[x["id"]] = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(x["lat_lng"][1],x["lat_lng"][0],x["lat_lng"][2]),
name: x["name"],
id: x["id"],
description:description,
point : {
pixelSize : 5,
color : Color,
outlineColor : Cesium.Color.WHITE,
outlineWidth : 2
}
});
});
});
function UpdateMap(e) {
var norad = e.data[0]
var name = e.data[1]
var satPos = e.data[2]
var observingStations = e.data[3]
var transmitters = e.data[4]
var Orbit = e.data[5]
if(Object.keys(Orbits).includes(norad)){
Orbits[norad].polyline = {
positions: Orbit,
width: 1,
followSurface: false,
material: new Cesium.ColorMaterialProperty(Cesium.Color(1.0, 1.0, 0.0, 0.5)),
}
}else{
Orbits[norad] = viewer.entities.add({
nane: name+" Obirt",
polyline: {
positions: Orbit,
width: 1,
followSurface: false,
material: new Cesium.ColorMaterialProperty(Cesium.Color(1.0, 1.0, 0.0, 0.5)),
}
});
}
popupText = "<b>Name: "+name+"</b><br><b>Norad: "+norad+"</b><br><b>Station Count: "+observingStations.length+"</b><br>"
transmitters.forEach(function(x){
//console.log(x + " "+norad)
popupText = popupText + '<div class="trans" style="background-color:'+x[1]+'";>'+x[0]+"</div>"
})
if(Object.keys(Satelites).includes(norad)){
Satelites[norad].position = satPos
Satelites[norad].description = popupText
}else{
Satelites[norad] =viewer.entities.add({
position : satPos,
name: name,
id: norad,
description:popupText,
point : {
pixelSize : 10,
color : Cesium.Color.RED,
outlineWidth : 2
}
});
}
if(Object.keys(Lines).includes(norad)){
Object.keys(Lines[norad]).forEach(
function(x){
viewer.entities.remove(Lines[norad][x])
delete Lines[norad][x]
})
}else{
Lines[norad] = {}
}
observingStations.forEach(function(x){
Lines[norad][x[0]] = viewer.entities.add({polyline: {
followSurface: false,
width:4,
positions: new Cesium.PositionPropertyArray([
new Cesium.ReferenceProperty(
viewer.entities,
Satelites[norad].id,
[ 'position' ]
),
new Cesium.ReferenceProperty(
viewer.entities,
Stations[x[0]].id,
[ 'position' ]
)
]),
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(x[1]))
}
})})
}
$.get("/occuring_sats", function(data, status){
data = JSON.parse(data)
Object.keys(data).forEach(function(x){
worker = new Worker('Worker.js');
worker.onmessage = UpdateMap
worker.postMessage([x,data[x]]);
Workers[x] =worker
});
});
setInterval(function(){
$.get("/occuring_sats", function(data, status){
data = JSON.parse(data)
Object.keys(Workers).forEach(function(x){
if(Object.keys(data).includes(x)){}else{
console.log(x)
Workers[x].terminate()
delete Workers[x]
viewer.entities.remove(Satelites[x])
viewer.entities.remove(Orbits[x])
viewer.entities.remove(Satelites[x])
viewer.entities.remove(Orbits[x])
delete Satelites[x]
delete Orbits[x]
delete Workers[x]
}
});
Object.keys(data).forEach(function(x){
worker = new Worker('Worker.js');
worker.onmessage = UpdateMap
worker.postMessage([x,data[x]]);
Workers[x] =worker
});
});
}, 60000);
</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>
<b> Use just https://satnogs-dev.jwgtechs.com</b>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1,73 +0,0 @@
self.importScripts("satellite.js");
self.importScripts("moment.min.js");
self.importScripts("https://cesiumjs.org/releases/1.53/Build/Cesium/Cesium.js")
norad = ""
groundStations = []
satrec = null
Orbits = []
name = ""
onmessage = function(e) {
norad = e.data[0]
name = e.data[1][0]
satrec = self.satellite_js.twoline2satrec(e.data[1][1],e.data[1][2]);
getStations()
Orbits = getObrit()
}
setInterval(function(){
getStations()
}, 10000);
setInterval(function(){
getObrit()
}, 60000*5);
setInterval(function(){
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)
if (groundStations[1] == undefined){
groundStations.push([])
}
postMessage([norad,name,self.Cesium.Ellipsoid.WGS84.cartographicToCartesian(new self.Cesium.Cartographic(positionGd.longitude, positionGd.latitude, (positionGd.height*1000))),groundStations[0],groundStations[1],Orbits])
}, 10000);
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 getObrit(){
satelliteOrbit = []
for (var i = 0; i < 30; i++){
time = moment().subtract(10,"m").add(i*1,"m")
var gmst = self.satellite_js.gstime(new Date(time.valueOf()));
var positionAndVelocity = self.satellite_js.propagate(satrec, new Date(time.valueOf()));
var positionEci = positionAndVelocity.position
var positionGd = self.satellite_js.eciToGeodetic(positionEci, gmst)
satelliteOrbit = satelliteOrbit.concat(self.Cesium.Ellipsoid.WGS84.cartographicToCartesian(new self.Cesium.Cartographic(positionGd.longitude, positionGd.latitude, positionGd.height*1000)));
}
return satelliteOrbit
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,39 +1 @@
<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="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.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',{shadows:true,timeline:false,vrButton:false,homeButton:false,animation:true,baseLayerPicker:true});
viewer.terrainProvider = Cesium.createWorldTerrain();
viewer.scene.globe.shadows=Cesium.ShadowMode.CAST_ONLY
viewer.scene.globe.enableLighting = true
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czml"))
var now = new Cesium.JulianDate();
viewer.clock.currentTime = now;
viewer.clock.shouldAnimate = true
</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>
<b> Use just https://satnogs-dev.jwgtechs.com</b>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB