Color the lines and make the case of no TLE work better.
parent
385d5a091d
commit
8fd414dc9f
|
@ -4,7 +4,7 @@ from flask import Flask , render_template,redirect,url_for
|
||||||
import json
|
import json
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
import ephem
|
import ephem
|
||||||
from satnogs_api_client import fetch_satellites, DB_BASE_URL
|
from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation
|
||||||
from satellite_tle import fetch_tles
|
from satellite_tle import fetch_tles
|
||||||
|
|
||||||
scheduler = BackgroundScheduler()
|
scheduler = BackgroundScheduler()
|
||||||
|
@ -177,8 +177,8 @@ def api_occuring_sats():
|
||||||
obs = {}
|
obs = {}
|
||||||
for x in Passes:
|
for x in Passes:
|
||||||
if x.satellite['norad_cat_id'] not in TLEs.keys():
|
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()
|
q = fetch_tle_of_observation(x.id)
|
||||||
TLEs[ x.satellite['norad_cat_id'] ] = [str(q["name"]),str(q["tle1"]),str(q["tle2"])]
|
TLEs[ x.satellite['norad_cat_id'] ] = [str(x.satellite["name"]),str(q[0]),str(q[1])]
|
||||||
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)
|
||||||
|
|
|
@ -68,6 +68,8 @@ stationList = {}
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var sats = {}
|
var sats = {}
|
||||||
|
|
||||||
var links = {}
|
var links = {}
|
||||||
|
@ -85,7 +87,7 @@ var 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){
|
||||||
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: '#'+entry[1].toString(16).repeat(2).substr(0,6),weight: 3,opacity: 1,smoothFactor: 1});
|
||||||
firstpolyline.addTo(mymap)
|
firstpolyline.addTo(mymap)
|
||||||
firstpolyline.bringToFront()
|
firstpolyline.bringToFront()
|
||||||
links[entry[0]] = firstpolyline
|
links[entry[0]] = firstpolyline
|
||||||
|
@ -133,7 +135,7 @@ setInterval(function(){
|
||||||
|
|
||||||
})
|
})
|
||||||
data.forEach(function(entry){
|
data.forEach(function(entry){
|
||||||
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: '#'+entry[1].toString(16).repeat(2).substr(0,6),weight:3,opacity:1,smoothFactor: 1});
|
||||||
firstpolyline.addTo(mymap)
|
firstpolyline.addTo(mymap)
|
||||||
links[entry[0]] = firstpolyline
|
links[entry[0]] = firstpolyline
|
||||||
stationList[entry[0]].setIcon(active_station)
|
stationList[entry[0]].setIcon(active_station)
|
||||||
|
|
Loading…
Reference in New Issue