1
0
Fork 0

Update from local source.

dev 1.0
wgaylord 2018-11-21 14:28:37 -06:00
parent 161dcf5054
commit bf3b902e7a
6 changed files with 42 additions and 26 deletions

View File

@ -24,6 +24,7 @@ class Pass:
ground_station = None
satellite = None
transmitter = None
norad = 0
def __repr__(self):
return "\n<ID>: {}\n<Start>: {}\n<End>: {}\n<Ground Station>: {}\n<Satellite> {}\n<Transmitter>: {}".format(self.id,self.start.strftime('%Y-%m-%dT%H:%M:%S%z'),self.end.strftime('%Y-%m-%dT%H:%M:%S%z'),self.ground_station,json.dumps(self.satellite,indent = 1),json.dumps(self.transmitter,indent=1))
@ -65,8 +66,12 @@ def getActive():
temp.start = datetime.strptime(x["start"],'%Y-%m-%dT%H:%M:%Sz')
temp.end = datetime.strptime(x["end"],'%Y-%m-%dT%H:%M:%Sz')
temp.ground_station = x["ground_station"]
temp.satellite = requests.get("https://db.satnogs.org/api/satellites/"+str(x["norad_cat_id"])) .json()
temp.transmitter = requests.get("https://db.satnogs.org/api/transmitters/"+x["transmitter"]).json()
temp.norad = str(x["norad_cat_id"])
try:
temp.satellite = requests.get("https://db.satnogs.org/api/satellites/"+str(x["norad_cat_id"])) .json()
except:
temp.satellite = {"name":""}
#temp.transmitter = requests.get("https://db.satnogs.org/api/transmitters/"+x["transmitter"]).json()
Passes.append(temp)
@ -106,7 +111,7 @@ def updatePasses():
print "Updating Passes"
Passes = getActive()
@scheduler.scheduled_job('interval',hours=10)
@scheduler.scheduled_job('interval',hours=1)
def updateStations():
global Stations
print "Updating Stations"
@ -175,20 +180,23 @@ def api_occuring_sats():
for x in Passes:
if x.satellite['norad_cat_id'] not in TLEs.keys():
q = fetch_tle_of_observation(x.id)
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])
TLEs[ x.norad ] = [str(x.satellite["name"]),str(q[0]),str(q[1])]
satellite = ephem.readtle(TLEs[x.norad][0],TLEs[x.norad][1],TLEs[x.norad][2])
now = datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
satellite.compute(now)
lat = satellite.sublat*57.295779514
long = satellite.sublong*57.295779514
obs[x.satellite['norad_cat_id']] = {"name":x.satellite["name"],"lat_lng":[lat,long],"eclipsed":satellite.eclipsed,"image":x.satellite["image"]}
if x.satellite['norad_cat_id'] == 25544:
obs[x.norad] = {"name":satellite.name,"lat_lng":[lat,long],"eclipsed":satellite.eclipsed,"image":"/static/ISS"}
else:
obs[x.norad] = {"name":satellite.name,"lat_lng":[lat,long],"eclipsed":satellite.eclipsed,"image":None}
return json.dumps(obs)
@app.route('/api/satstationpairs')
def api_sat_station_pairs():
pairs = []
for x in Passes:
pairs.append([x.ground_station,x.satellite['norad_cat_id']])
pairs.append([x.ground_station,x.norad])
return json.dumps(pairs)
@app.route('/api/getsatloc/<int:norad>')

BIN
static/ISS-dark.png 100644

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -9,6 +9,7 @@
<script src=" https://unpkg.com/@joergdietrich/leaflet.terminator@1.0.0/L.Terminator.js"></script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script src="/static/Leaflet.Geodesic.js"></script>
</head>
<style>
@ -28,19 +29,12 @@
</div>
</div>
</div>
<!-- Satnogs -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-3327739403768095"
data-ad-slot="5333748891"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<script>
var light_sat = L.icon({
iconUrl: 'static/light-satellite-marker.png',
iconUrl: 'static/satellite-marker-light.png',
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
@ -48,7 +42,7 @@ var light_sat = L.icon({
});
var dark_sat = L.icon({
iconUrl: 'static/satellite-marker.png',
iconUrl: 'static/satellite-marker-dark.png',
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
@ -104,10 +98,17 @@ var links = {}
sat = dark_sat
}
if(data[key]["image"] != null){
image = data[key]["image"]
if(data[key]["eclipsed"]){
image = image + "-dark.png"
}else{
image = image + "-light.png"
}
sat = L.icon({
iconUrl: data[key]["image"],
iconSize: [20, 20],
iconAnchor: [10, 10],
iconUrl: image,
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
});
@ -154,14 +155,21 @@ setInterval(function(){
Object.keys(data).forEach(function(key){
sat = light_sat
if(data[key]["eclipsed"]){
sat = dark_sat
}
if(data[key]["image"] != null){
image = data[key]["image"]
if(data[key]["eclipsed"]){
sat = dark_sat
}
if(data[key]["image"] != null){
image = image + "-dark.png"
}else{
image = image + "-light.png"
}
sat = L.icon({
iconUrl: data[key]["image"],
iconSize: [20, 20],
iconAnchor: [10, 10],
iconUrl: image,
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
});