1
0
Fork 0

Totally recode whole system.

merge-requests/2/head
wgaylord 2019-02-20 14:00:22 -06:00
parent 062f7d3099
commit d9d3c3aa58
32 changed files with 1011 additions and 476 deletions

41
Leap_Second.dat 100644
View File

@ -0,0 +1,41 @@
# Value of TAI-UTC in second valid beetween the initial value until
# the epoch given on the next line. The last line reads that NO
# leap second was introduced since the corresponding date
# Updated through IERS Bulletin 57 issued in January 2019
#
#
# File expires on 28 December 2019
#
#
# MJD Date TAI-UTC (s)
# day month year
# --- -------------- ------
#
41317.0 1 1 1972 10
41499.0 1 7 1972 11
41683.0 1 1 1973 12
42048.0 1 1 1974 13
42413.0 1 1 1975 14
42778.0 1 1 1976 15
43144.0 1 1 1977 16
43509.0 1 1 1978 17
43874.0 1 1 1979 18
44239.0 1 1 1980 19
44786.0 1 7 1981 20
45151.0 1 7 1982 21
45516.0 1 7 1983 22
46247.0 1 7 1985 23
47161.0 1 1 1988 24
47892.0 1 1 1990 25
48257.0 1 1 1991 26
48804.0 1 7 1992 27
49169.0 1 7 1993 28
49534.0 1 7 1994 29
50083.0 1 1 1996 30
50630.0 1 7 1997 31
51179.0 1 1 1999 32
53736.0 1 1 2006 33
54832.0 1 1 2009 34
56109.0 1 7 2012 35
57204.0 1 7 2015 36
57754.0 1 1 2017 37

View File

@ -1,10 +1,3 @@
# SatnogsMap
#Satnogs-Map
Uses Satnogs data to generate a map of all stations on Production and all sats currently observed.
Currently hosted at satnogs.minecraft16.ml
The server itself is in the server folder and the views are in the view folder.
Uses CesiumJS and a python backend to make a very nice map view of the satnogs network.

552
deltat.data 100644
View File

@ -0,0 +1,552 @@
1973 2 1 43.4724
1973 3 1 43.5648
1973 4 1 43.6737
1973 5 1 43.7782
1973 6 1 43.8763
1973 7 1 43.9562
1973 8 1 44.0315
1973 9 1 44.1132
1973 10 1 44.1982
1973 11 1 44.2952
1973 12 1 44.3936
1974 1 1 44.4841
1974 2 1 44.5646
1974 3 1 44.6425
1974 4 1 44.7386
1974 5 1 44.8370
1974 6 1 44.9302
1974 7 1 44.9986
1974 8 1 45.0584
1974 9 1 45.1284
1974 10 1 45.2064
1974 11 1 45.2980
1974 12 1 45.3897
1975 1 1 45.4761
1975 2 1 45.5632
1975 3 1 45.6450
1975 4 1 45.7375
1975 5 1 45.8284
1975 6 1 45.9133
1975 7 1 45.9820
1975 8 1 46.0407
1975 9 1 46.1067
1975 10 1 46.1825
1975 11 1 46.2789
1975 12 1 46.3713
1976 1 1 46.4567
1976 2 1 46.5445
1976 3 1 46.6311
1976 4 1 46.7302
1976 5 1 46.8284
1976 6 1 46.9247
1976 7 1 46.9970
1976 8 1 47.0709
1976 9 1 47.1450
1976 10 1 47.2362
1976 11 1 47.3413
1976 12 1 47.4319
1977 1 1 47.5214
1977 2 1 47.6049
1977 3 1 47.6837
1977 4 1 47.7781
1977 5 1 47.8771
1977 6 1 47.9687
1977 7 1 48.0348
1977 8 1 48.0942
1977 9 1 48.1608
1977 10 1 48.2460
1977 11 1 48.3439
1977 12 1 48.4355
1978 1 1 48.5344
1978 2 1 48.6324
1978 3 1 48.7294
1978 4 1 48.8365
1978 5 1 48.9353
1978 6 1 49.0319
1978 7 1 49.1013
1978 8 1 49.1591
1978 9 1 49.2286
1978 10 1 49.3070
1978 11 1 49.4018
1978 12 1 49.4945
1979 1 1 49.5861
1979 2 1 49.6805
1979 3 1 49.7602
1979 4 1 49.8556
1979 5 1 49.9489
1979 6 1 50.0347
1979 7 1 50.1019
1979 8 1 50.1622
1979 9 1 50.2260
1979 10 1 50.2968
1979 11 1 50.3831
1979 12 1 50.4599
1980 1 1 50.5387
1980 2 1 50.6160
1980 3 1 50.6866
1980 4 1 50.7658
1980 5 1 50.8454
1980 6 1 50.9187
1980 7 1 50.9761
1980 8 1 51.0278
1980 9 1 51.0843
1980 10 1 51.1538
1980 11 1 51.2319
1980 12 1 51.3063
1981 1 1 51.3808
1981 2 1 51.4526
1981 3 1 51.5160
1981 4 1 51.5985
1981 5 1 51.6809
1981 6 1 51.7573
1981 7 1 51.8133
1981 8 1 51.8532
1981 9 1 51.9014
1981 10 1 51.9603
1981 11 1 52.0328
1981 12 1 52.0985
1982 1 1 52.1668
1982 2 1 52.2316
1982 3 1 52.2938
1982 4 1 52.3680
1982 5 1 52.4465
1982 6 1 52.5180
1982 7 1 52.5751
1982 8 1 52.6178
1982 9 1 52.6668
1982 10 1 52.7340
1982 11 1 52.8056
1982 12 1 52.8792
1983 1 1 52.9565
1983 2 1 53.0445
1983 3 1 53.1268
1983 4 1 53.2197
1983 5 1 53.3024
1983 6 1 53.3747
1983 7 1 53.4335
1983 8 1 53.4778
1983 9 1 53.5300
1983 10 1 53.5845
1983 11 1 53.6523
1983 12 1 53.7256
1984 1 1 53.7882
1984 2 1 53.8367
1984 3 1 53.8830
1984 4 1 53.9443
1984 5 1 54.0042
1984 6 1 54.0536
1984 7 1 54.0856
1984 8 1 54.1084
1984 9 1 54.1463
1984 10 1 54.1914
1984 11 1 54.2452
1984 12 1 54.2958
1985 1 1 54.3427
1985 2 1 54.3911
1985 3 1 54.4320
1985 4 1 54.4898
1985 5 1 54.5456
1985 6 1 54.5977
1985 7 1 54.6355
1985 8 1 54.6532
1985 9 1 54.6776
1985 10 1 54.7174
1985 11 1 54.7741
1985 12 1 54.8253
1986 1 1 54.8712
1986 2 1 54.9161
1986 3 1 54.9581
1986 4 1 54.9997
1986 5 1 55.0476
1986 6 1 55.0912
1986 7 1 55.1132
1986 8 1 55.1328
1986 9 1 55.1532
1986 10 1 55.1898
1986 11 1 55.2416
1986 12 1 55.2838
1987 1 1 55.3222
1987 2 1 55.3613
1987 3 1 55.4063
1987 4 1 55.4629
1987 5 1 55.5111
1987 6 1 55.5524
1987 7 1 55.5812
1987 8 1 55.6004
1987 9 1 55.6262
1987 10 1 55.6656
1987 11 1 55.7168
1987 12 1 55.7698
1988 1 1 55.8197
1988 2 1 55.8615
1988 3 1 55.9130
1988 4 1 55.9663
1988 5 1 56.0220
1988 6 1 56.0700
1988 7 1 56.0939
1988 8 1 56.1105
1988 9 1 56.1314
1988 10 1 56.1611
1988 11 1 56.2068
1988 12 1 56.2582
1989 1 1 56.3000
1989 2 1 56.3399
1989 3 1 56.3790
1989 4 1 56.4283
1989 5 1 56.4804
1989 6 1 56.5352
1989 7 1 56.5697
1989 8 1 56.5983
1989 9 1 56.6328
1989 10 1 56.6739
1989 11 1 56.7332
1989 12 1 56.7972
1990 1 1 56.8553
1990 2 1 56.9111
1990 3 1 56.9755
1990 4 1 57.0471
1990 5 1 57.1136
1990 6 1 57.1738
1990 7 1 57.2226
1990 8 1 57.2597
1990 9 1 57.3073
1990 10 1 57.3643
1990 11 1 57.4334
1990 12 1 57.5016
1991 1 1 57.5653
1991 2 1 57.6333
1991 3 1 57.6973
1991 4 1 57.7711
1991 5 1 57.8407
1991 6 1 57.9058
1991 7 1 57.9576
1991 8 1 57.9975
1991 9 1 58.0425
1991 10 1 58.1043
1991 11 1 58.1679
1991 12 1 58.2389
1992 1 1 58.3092
1992 2 1 58.3833
1992 3 1 58.4537
1992 4 1 58.5401
1992 5 1 58.6228
1992 6 1 58.6917
1992 7 1 58.7410
1992 8 1 58.7836
1992 9 1 58.8406
1992 10 1 58.8986
1992 11 1 58.9714
1992 12 1 59.0438
1993 1 1 59.1218
1993 2 1 59.2003
1993 3 1 59.2747
1993 4 1 59.3574
1993 5 1 59.4434
1993 6 1 59.5242
1993 7 1 59.5850
1993 8 1 59.6343
1993 9 1 59.6928
1993 10 1 59.7588
1993 11 1 59.8386
1993 12 1 59.9111
1994 1 1 59.9845
1994 2 1 60.0564
1994 3 1 60.1231
1994 4 1 60.2042
1994 5 1 60.2804
1994 6 1 60.3530
1994 7 1 60.4012
1994 8 1 60.4440
1994 9 1 60.4900
1994 10 1 60.5578
1994 11 1 60.6324
1994 12 1 60.7059
1995 1 1 60.7853
1995 2 1 60.8663
1995 3 1 60.9387
1995 4 1 61.0277
1995 5 1 61.1103
1995 6 1 61.1870
1995 7 1 61.2454
1995 8 1 61.2881
1995 9 1 61.3378
1995 10 1 61.4036
1995 11 1 61.4760
1995 12 1 61.5525
1996 1 1 61.6287
1996 2 1 61.6846
1996 3 1 61.7433
1996 4 1 61.8132
1996 5 1 61.8823
1996 6 1 61.9497
1996 7 1 61.9969
1996 8 1 62.0343
1996 9 1 62.0714
1996 10 1 62.1202
1996 11 1 62.1809
1996 12 1 62.2382
1997 1 1 62.2950
1997 2 1 62.3506
1997 3 1 62.3995
1997 4 1 62.4754
1997 5 1 62.5463
1997 6 1 62.6136
1997 7 1 62.6571
1997 8 1 62.6942
1997 9 1 62.7383
1997 10 1 62.7926
1997 11 1 62.8567
1997 12 1 62.9146
1998 1 1 62.9659
1998 2 1 63.0217
1998 3 1 63.0807
1998 4 1 63.1462
1998 5 1 63.2053
1998 6 1 63.2599
1998 7 1 63.2844
1998 8 1 63.2961
1998 9 1 63.3126
1998 10 1 63.3422
1998 11 1 63.3871
1998 12 1 63.4339
1999 1 1 63.4673
1999 2 1 63.4979
1999 3 1 63.5319
1999 4 1 63.5679
1999 5 1 63.6104
1999 6 1 63.6444
1999 7 1 63.6642
1999 8 1 63.6739
1999 9 1 63.6926
1999 10 1 63.7147
1999 11 1 63.7518
1999 12 1 63.7927
2000 1 1 63.8285
2000 2 1 63.8557
2000 3 1 63.8804
2000 4 1 63.9075
2000 5 1 63.9393
2000 6 1 63.9691
2000 7 1 63.9799
2000 8 1 63.9833
2000 9 1 63.9938
2000 10 1 64.0093
2000 11 1 64.0400
2000 12 1 64.0670
2001 1 1 64.0908
2001 2 1 64.1068
2001 3 1 64.1282
2001 4 1 64.1584
2001 5 1 64.1833
2001 6 1 64.2094
2001 7 1 64.2117
2001 8 1 64.2073
2001 9 1 64.2116
2001 10 1 64.2223
2001 11 1 64.2500
2001 12 1 64.2761
2002 1 1 64.2998
2002 2 1 64.3192
2002 3 1 64.3450
2002 4 1 64.3735
2002 5 1 64.3943
2002 6 1 64.4151
2002 7 1 64.4132
2002 8 1 64.4118
2002 9 1 64.4097
2002 10 1 64.4168
2002 11 1 64.4329
2002 12 1 64.4511
2003 1 1 64.4734
2003 2 1 64.4893
2003 3 1 64.5053
2003 4 1 64.5269
2003 5 1 64.5471
2003 6 1 64.5597
2003 7 1 64.5512
2003 8 1 64.5371
2003 9 1 64.5359
2003 10 1 64.5415
2003 11 1 64.5544
2003 12 1 64.5654
2004 1 1 64.5736
2004 2 1 64.5891
2004 3 1 64.6015
2004 4 1 64.6176
2004 5 1 64.6374
2004 6 1 64.6549
2004 7 1 64.6530
2004 8 1 64.6379
2004 9 1 64.6372
2004 10 1 64.6400
2004 11 1 64.6543
2004 12 1 64.6723
2005 1 1 64.6876
2005 2 1 64.7052
2005 3 1 64.7313
2005 4 1 64.7575
2005 5 1 64.7811
2005 6 1 64.8001
2005 7 1 64.7995
2005 8 1 64.7876
2005 9 1 64.7831
2005 10 1 64.7921
2005 11 1 64.8096
2005 12 1 64.8311
2006 1 1 64.8452
2006 2 1 64.8597
2006 3 1 64.8850
2006 4 1 64.9175
2006 5 1 64.9480
2006 6 1 64.9794
2006 7 1 64.9895
2006 8 1 65.0028
2006 9 1 65.0138
2006 10 1 65.0371
2006 11 1 65.0773
2006 12 1 65.1122
2007 1 1 65.1464
2007 2 1 65.1833
2007 3 1 65.2145
2007 4 1 65.2494
2007 5 1 65.2921
2007 6 1 65.3279
2007 7 1 65.3413
2007 8 1 65.3452
2007 9 1 65.3496
2007 10 1 65.3711
2007 11 1 65.3972
2007 12 1 65.4296
2008 1 1 65.4573
2008 2 1 65.4868
2008 3 1 65.5152
2008 4 1 65.5450
2008 5 1 65.5781
2008 6 1 65.6127
2008 7 1 65.6287
2008 8 1 65.6370
2008 9 1 65.6493
2008 10 1 65.6760
2008 11 1 65.7097
2008 12 1 65.7461
2009 1 1 65.7768
2009 2 1 65.8025
2009 3 1 65.8237
2009 4 1 65.8595
2009 5 1 65.8973
2009 6 1 65.9323
2009 7 1 65.9509
2009 8 1 65.9534
2009 9 1 65.9628
2009 10 1 65.9839
2009 11 1 66.0147
2009 12 1 66.0420
2010 1 1 66.0699
2010 2 1 66.0961
2010 3 1 66.1310
2010 4 1 66.1683
2010 5 1 66.2072
2010 6 1 66.2356
2010 7 1 66.2409
2010 8 1 66.2335
2010 9 1 66.2349
2010 10 1 66.2441
2010 11 1 66.2751
2010 12 1 66.3054
2011 1 1 66.3246
2011 2 1 66.3406
2011 3 1 66.3624
2011 4 1 66.3957
2011 5 1 66.4289
2011 6 1 66.4619
2011 7 1 66.4749
2011 8 1 66.4751
2011 9 1 66.4829
2011 10 1 66.5056
2011 11 1 66.5383
2011 12 1 66.5706
2012 1 1 66.6030
2012 2 1 66.6340
2012 3 1 66.6569
2012 4 1 66.6925
2012 5 1 66.7289
2012 6 1 66.7579
2012 7 1 66.7708
2012 8 1 66.7740
2012 9 1 66.7846
2012 10 1 66.8103
2012 11 1 66.8400
2012 12 1 66.8779
2013 1 1 66.9069
2013 2 1 66.9443
2013 3 1 66.9762
2013 4 1 67.0258
2013 5 1 67.0716
2013 6 1 67.1100
2013 7 1 67.1266
2013 8 1 67.1331
2013 9 1 67.1458
2013 10 1 67.1717
2013 11 1 67.2091
2013 12 1 67.2460
2014 1 1 67.2810
2014 2 1 67.3136
2014 3 1 67.3457
2014 4 1 67.3890
2014 5 1 67.4318
2014 6 1 67.4666
2014 7 1 67.4858
2014 8 1 67.4989
2014 9 1 67.5111
2014 10 1 67.5353
2014 11 1 67.5711
2014 12 1 67.6070
2015 1 1 67.6439
2015 2 1 67.6765
2015 3 1 67.7117
2015 4 1 67.7591
2015 5 1 67.8012
2015 6 1 67.8402
2015 7 1 67.8606
2015 8 1 67.8822
2015 9 1 67.9120
2015 10 1 67.9546
2015 11 1 68.0055
2015 12 1 68.0514
2016 1 1 68.1024
2016 2 1 68.1577
2016 3 1 68.2044
2016 4 1 68.2664
2016 5 1 68.3188
2016 6 1 68.3704
2016 7 1 68.3964
2016 8 1 68.4094
2016 9 1 68.4305
2016 10 1 68.4630
2016 11 1 68.5078
2016 12 1 68.5537
2017 1 1 68.5927
2017 2 1 68.6298
2017 3 1 68.6671
2017 4 1 68.7135
2017 5 1 68.7623
2017 6 1 68.8033
2017 7 1 68.8245
2017 8 1 68.8373
2017 9 1 68.8477
2017 10 1 68.8689
2017 11 1 68.9006
2017 12 1 68.9355
2018 1 1 68.9676
2018 2 1 68.9875
2018 3 1 69.0175
2018 4 1 69.0499
2018 5 1 69.0823
2018 6 1 69.1070
2018 7 1 69.1134
2018 8 1 69.1142
2018 9 1 69.1207
2018 10 1 69.1356
2018 11 1 69.1646
2018 12 1 69.1964
2019 1 1 69.2201

37
deltat.preds 100644
View File

@ -0,0 +1,37 @@
MJD YEAR TT-UT Pred UT1-UTC Pred ERROR
58484.000 2019.00 69.34 -0.152 0.117
58575.000 2019.25 69.48 -0.295 0.162
58666.000 2019.50 69.62 -0.440 0.215
58758.000 2019.75 69.71 -0.527 0.273
58849.000 2020.00 69.87 0.335
58940.000 2020.25 70.03 0.399
59032.000 2020.50 70.16 0.465
59123.000 2020.75 70.24 0.532
59214.000 2021.00 70.39 0.600
59306.000 2021.25 70.55 0.668
59397.000 2021.50 70.68 0.736
59488.000 2021.75 70.76 0.803
59580.000 2022.00 70.91 0.870
59671.000 2022.25 71.06 0.936
59762.000 2022.50 71.18 1.000
59853.000 2022.75 71.25 1.064
59945.000 2023.00 71.40 1.126
60036.000 2023.25 71.54 1.186
60127.000 2023.50 71.67 1.245
60219.000 2023.75 71.74 1.302
60310.000 2024.00 71.88 1.358
60401.000 2024.25 72.03 1.411
60493.000 2024.50 72.15 1.463
60584.000 2024.75 72.22 1.514
60675.000 2025.00 72.36 1.562
60767.000 2025.25 72.50 1.609
60858.000 2025.50 72.62 1.654
60949.000 2025.75 72.69 1.697
61041.000 2026.00 72.83 1.738
61132.000 2026.25 72.98 1.778
61223.000 2026.50 73.10 1.816
61314.000 2026.75 73.17 1.853
61406.000 2027.00 73.32 1.887
61497.000 2027.25 73.46 1.921
61588.000 2027.50 73.58 1.953
61680.000 2027.75 73.66 1.983

226
satnogs.py 100644
View File

@ -0,0 +1,226 @@
from datetime import datetime , timedelta
import requests
from tqdm import tqdm
from flask import Flask , render_template,redirect,url_for
import json
from collections import defaultdict
import random
from apscheduler.schedulers.background import BackgroundScheduler
from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation ,get_paginated_endpoint
from satellite_tle import fetch_tles
from skyfield.api import EarthSatellite,utc,load
scheduler = BackgroundScheduler()
app = Flask(__name__)
ts = load.timescale()
broken = defaultdict(set)
Sats = defaultdict(list)
Passes = defaultdict(list)
Stations = []
TLEs = defaultdict(list)
Transmitters = defaultdict(dict)
CZML = []
def getFuture():
print "Getting future Passes"
global Sats
global TLEs
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')
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)
for x in tqdm(obs):
observations[x["id"]] = x
ground_stations = {}
Sats = defaultdict(list)
for x in tqdm(passes):
if x["id"] in observations:
try:
start = datetime.strptime(x["start"],'%Y-%m-%dT%H:%M:%Sz')
start = start.replace(tzinfo=utc)
end = datetime.strptime(x["end"],'%Y-%m-%dT%H:%M:%Sz')
end = end.replace(tzinfo=utc)
# "transmitter":Transmitters[observations[x["id"]]["norad_cat_id"]][x["transmitter"]]
Sats[observations[x["id"]]["norad_cat_id"]].append({"station":x["ground_station"],"transmitter":Transmitters[observations[x["id"]]["norad_cat_id"]][x["transmitter"]],"start":start,"end":end,"id":x["id"]})
TLEs[observations[x["id"]]["norad_cat_id"]]=[x["tle0"],x["tle1"],x["tle2"]]
except Exception as e:
print "Error on observation number: "+str(x["id"])+ " "+str(e)
broken[observations[x["id"]]["norad_cat_id"]].update([x["transmitter"]])
print str(len(Sats))+" Future passes found."
def GetGroundStations():
print "Getting Ground Stations"
stations = get_paginated_endpoint("https://network.satnogs.org/api/stations/")
return stations
def updateTLE():
print "Updating TLE"
global TLEs
sats = fetch_satellites(None,DB_BASE_URL)
satnogs_db_norad_ids = set(sat['norad_cat_id'] for sat in sats if sat['status'] != 're-entered')
# Remove satellites with temporary norad ids
temporary_norad_ids = set(filter(lambda norad_id: norad_id >= 99900, satnogs_db_norad_ids))
satnogs_db_norad_ids = satnogs_db_norad_ids - temporary_norad_ids
# Fetch TLEs for the satellites of interest
tles = fetch_tles(satnogs_db_norad_ids)
TLEs = {}
for norad_id, (source, tle) in tqdm(tles.items()):
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)))
@scheduler.scheduled_job('interval',days=5)
def updateTransmitters():
global Transmitters
print "Updating Transmitters"
temp = requests.get("https://db.satnogs.org/api/transmitters/").json()
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]]
@scheduler.scheduled_job('interval',hours=1)
def updatePasses():
getFuture()
@scheduler.scheduled_job('interval',hours=1)
def updateStations():
global Stations
print "Updating Stations"
Stations = GetGroundStations()
@scheduler.scheduled_job('interval',minutes=30)
def updateCZML():
doc = {}
doc["id"] = "document"
doc["name"] = "sats"
doc["version"]="1.0"
doc["clock"]={}
doc["clock"]["interval"]="0000-00-00T00:00:00Z/9999-12-31T24:00:00Z"
doc["clock"]["currentTime"] = datetime.utcnow().isoformat()+"Z"
doc["clock"]["step"] = "SYSTEM_CLOCK_MULTIPLER"
CZML.append(doc)
StationList = {}
for x in tqdm(Stations):
color = [0,230,64,255]
if x["status"] == "Testing":
color = [248,148,6,255]
if x["status"] == "Offline":
color = [255,0,0,50]
station = {}
station["id"] = str(x["id"])
station["name"] = x["name"]
station["point"] = {}
station["show"] = True
station["point"]["color"] = {}
station["point"]["color"]["rgba"] = color
station["point"]["outlineColor"] = {}
station["point"]["outlineColor"]["rgba"] = [255,255,255,color[3]]
station["point"]["outlineWidth"] = 2.0
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"]
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["position"] = {}
sat["position"]["cartographicDegrees"]=[]
temp = y["start"]
satObj = EarthSatellite(TLEs[x][1],TLEs[x][2],TLEs[x][0])
time = 0
while temp <= y["end"]+timedelta(minutes=1):
subpoint = satObj.at(ts.utc(temp)).subpoint()
lat = subpoint.latitude.degrees
lng = subpoint.longitude.degrees
elevation = subpoint.elevation.m
sat["position"]["cartographicDegrees"].extend([time,lng,lat,elevation])
time+=60
temp = temp+timedelta(minutes=1)
sat["position"]["interpolationAlgorithm"] = "LAGRANGE"
sat["position"]["interpolationDegree"] = 5
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"]}}
CZML.append(sat)
@app.route("/")
def index():
return render_template("index.html")
@app.route('/future_sats')
def api_future_sats():
return json.dumps(Sats)
@app.route("/czml")
def api_czml():
return json.dumps(CZML)
@app.route("/broken")
def api_broken():
output = defaultdict(list)
for x in broken.keys():
output[x]=list(broken[x])
return json.dumps(output)
#updatePasses()
updateStations()
updateTransmitters()
getFuture()
updateCZML()
#updateTLE()
#updatePasses()
scheduler.start()
app.run(use_reloader=False,host = "0.0.0.0",port=5001)

Binary file not shown.

View File

@ -1,3 +0,0 @@
Basic server that gives all data used by all the existing views that exist.
Place any folder from views into static and launch the server to be able to access that view of the satnogs network.

View File

@ -1,197 +0,0 @@
from datetime import datetime , timedelta
import requests
from flask import Flask , render_template,redirect,url_for
import json
import random
from apscheduler.schedulers.background import BackgroundScheduler
from satnogs_api_client import fetch_satellites, DB_BASE_URL,fetch_tle_of_observation ,get_paginated_endpoint
from satellite_tle import fetch_tles
scheduler = BackgroundScheduler()
app = Flask(__name__)
Passes = []
Occuring_sats = {}
Stations = []
TLEs = {}
Transmitters = {}
class Pass:
id = 0
start = None
end = None
ground_station = None
satellite = None
transmitter = None
norad = 0
def getActive():
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')
passes = get_paginated_endpoint("https://network.satnogs.org/api/observations/?end="+end+"&format=json&start="+start)
ground_stations = {}
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():
passes.remove(x)
else:
if ground_stations.has_key(x["ground_station"]):
ground_stations[x["ground_station"]].append(x)
else:
ground_stations[x["ground_station"]] = []
ground_stations[x["ground_station"]].append(x)
passes = []
for x in ground_stations:
start = datetime.utcnow()
current = {"start":datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S%z')+"z"}
for y in ground_stations[x]:
if datetime.strptime(y["start"],'%Y-%m-%dT%H:%M:%Sz') < datetime.strptime(current["start"],'%Y-%m-%dT%H:%M:%Sz'):
current = y
passes.append(current)
Passes =[]
for x in passes:
temp = Pass()
temp.id = x["id"]
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.transmitter = x["transmitter"]
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":""}
Passes.append(temp)
return Passes
def GetGroundStations():
stations = get_paginated_endpoint("https://network.satnogs.org/api/stations/?status=2")
stations += get_paginated_endpoint("https://network.satnogs.org/api/stations/?status=1")
for x in stations:
if x["last_seen"] == None:
stations.remove(x)
continue
if x["status"] == "Offline":
stations.remove(x)
continue
if datetime.strptime(x["last_seen"],'%Y-%m-%dT%H:%M:%Sz') < (datetime.utcnow()- timedelta(10,0,0,0)):
stations.remove(x)
for x in stations:
if x["last_seen"] == None:
stations.remove(x)
continue
if x["status"] == "Offline":
stations.remove(x)
continue
if datetime.strptime(x["last_seen"],'%Y-%m-%dT%H:%M:%Sz') < (datetime.utcnow()- timedelta(10,0,0,0)):
stations.remove(x)
return stations
@scheduler.scheduled_job('interval',days=5)
def updateTransmitters():
global Transmitters
print "Updating Transmitters"
temp = requests.get("https://db.satnogs.org/api/transmitters/").json()
for x in temp:
if str(x["norad_cat_id"]) in Transmitters.keys():
Transmitters[str(x["norad_cat_id"])][x["uuid"]] = [x["description"],"#"+str("%06x" % random.randint(0, 0xFFFFFF))]
else:
Transmitters[str(x["norad_cat_id"])]={}
Transmitters[str(x["norad_cat_id"])][x["uuid"]] = [x["description"],"#"+str("%06x" % random.randint(0, 0xFFFFFF))]
#print Transmitters
@scheduler.scheduled_job('interval',minutes=2)
def updatePasses():
global Passes
global Occuring_sats
print "Updating Passes"
Passes = getActive()
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.norad ] = [str(x.satellite["name"]),str(q[0]),str(q[1])]
Occuring_sats[x.norad] = TLEs[x.norad]
@scheduler.scheduled_job('interval',hours=1)
def updateStations():
global Stations
print "Updating Stations"
Stations = GetGroundStations()
@scheduler.scheduled_job('interval',days=1)
def updateTLE():
print "Updating TLE"
global TlEs
sats = fetch_satellites(None,DB_BASE_URL)
satnogs_db_norad_ids = set(sat['norad_cat_id'] for sat in sats if sat['status'] != 're-entered')
# Remove satellites with temporary norad ids
temporary_norad_ids = set(filter(lambda norad_id: norad_id >= 99900, satnogs_db_norad_ids))
satnogs_db_norad_ids = satnogs_db_norad_ids - temporary_norad_ids
# Fetch TLEs for the satellites of interest
tles = fetch_tles(satnogs_db_norad_ids)
TLEs = {}
for norad_id, (source, tle) in tles.items():
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)))
@app.route("/")
def index():
return render_template("index.html")
@app.route('/active_stations')
def api_active_stations():
sations = []
for x in Stations:
sations.append({'id':x['id'],'name':x['name'],'lat_lng':[x["lat"],x['lng'],x["altitude"]],'type':x["status"],'description':x["description"],'total_obs':x["observations"],'qthlocator':x["qthlocator"]})
return json.dumps(sations)
@app.route('/stations_from_sat/<string:norad>')
def api_occuring_observations(norad):
obs = []
trans = []
for x in Passes:
if x.norad == norad:
obs.append([x.ground_station,Transmitters[norad][x.transmitter][1]])
trans.append(x.transmitter)
#print Transmitters[norad].values()
transList = []
for x in set(trans):
transList.append(Transmitters[norad][x])
#print transList,norad
return json.dumps([obs,transList])
@app.route('/occuring_sats')
def api_occuring_sats():
return json.dumps(Occuring_sats)
updatePasses()
updateStations()
updateTLE()
updateTransmitters()
scheduler.start()
app.run(use_reloader=False,host = "0.0.0.0",port=5001)

Binary file not shown.

View File

@ -1,14 +0,0 @@
<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>

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,73 @@
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
}

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,39 @@
<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>

1
static/globe2/moment.min.js vendored 100644

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
<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>

View File

@ -1,64 +0,0 @@
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)])
}
}

View File

@ -1,189 +0,0 @@
<head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"
integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA=="
crossorigin=""></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src=" https://unpkg.com/@joergdietrich/leaflet.terminator@1.0.0/L.Terminator.js"></script>
</head>
<style>
#mapid { height: 700px; }
</style>
<div id="mapid" ></div>
<script>
test = null
var light_sat = L.icon({
iconUrl: 'satellite-marker-light.png',
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
});
var dark_sat = L.icon({
iconUrl: 'satellite-marker-dark.png',
iconSize: [40, 40],
iconAnchor: [20, 20],
popupAnchor: [0, 0],
});
var station = L.icon({
iconUrl: 'station-marker.png',
iconSize: [10, 10],
iconAnchor: [5, 5],
popupAnchor: [0, 0],
});
var active_station = L.icon({
iconUrl: 'active-station-marker.png',
iconSize: [20, 20],
iconAnchor: [10, 10],
popupAnchor: [0, 0],
});
var mymap = L.map('mapid',{worldCopyJump:true}).setView([0,0], 2);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: 'pk.eyJ1IjoiY2hpYmlsbCIsImEiOiJjamxsNHBuZG4wdG1uM3FwYTN5c2ZubmxrIn0.ghkx6AngBzUiZQWBAWKziQ'
}).addTo(mymap);
var t = L.terminator();
t.addTo(mymap);
setInterval(function(){updateTerminator(t)}, 500);
function updateTerminator(t) {
var t2 = L.terminator();
t.setLatLngs(t2.getLatLngs());
t.redraw();
}
Stations = {}
Workers = {}
Lines = {}
Sats = {}
Orbits = {}
CurrentOrbit = null
dataS = null
function UpdateMap(e) {
var norad = e.data[0]
var name = e.data[1]
var satPos = e.data[2]
if (norad in Sats){
Sats[norad]._latlng = {"lat":satPos[0],"lng":satPos[1]}
Sats[norad].update()
}else{
Sats[norad] = L.marker(satPos,{icon: dark_sat,zIndexOffset:1000,title:norad}).addTo(mymap);
Sats[norad].norad = norad
Sats[norad].on('click',SatClick)
Lines[norad] = {}
Orbits[String(norad)] = e.data[5]
}
popupText = "<b>Name: "+name+"</b><br><b>Norad: "+norad+"</b><br><b>Station Count: "+e.data[3].length+"</b><br>"
e.data[4].forEach(function(x){
//console.log(x + " "+norad)
popupText = popupText + '<div class="trans" style="background-color:'+x[1]+'";>'+x[0]+"</div>"
})
Sats[norad].bindPopup(popupText)
Sats[norad]._popup.setContent(popupText)
Object.keys(Lines[norad]).forEach(function(x){
Lines[norad][x].removeFrom(mymap)
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);
})
}
$.get("/active_stations", function(data, status){
data = JSON.parse(data)
dataS = data
data.forEach(function(x){
marker = L.marker(x["lat_lng"],{icon: station,zIndexOffset:-1000}).addTo(mymap);
marker.bindPopup("<b>Name: "+x['name']+"</b>")
Stations[x["id"]] = marker
});
});
$.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(data).forEach(function(x){
if (x in Workers){
}else{
worker = new Worker('Worker.js');
worker.onmessage = UpdateMap
worker.postMessage([x,data[x]]);
Workers[x] =worker
}
});
Object.keys(Workers).forEach(function(x){
if (Object.keys(data).includes(x)){
}else{
Workers[x].terminate()
delete Workers[x]
UpdateMap({"data":[x,"",[0,0],[],[]]})
Sats[x].removeFrom(mymap)
delete Sats[x]
delete Lines[x]
}
})
});
}, 20000);
function SatClick(e){
if (CurrentOrbit == null){
}else{
CurrentOrbit.removeFrom(mymap)
}
CurrentOrbit = L.polyline(Orbits[Number(e.target.norad)], {color: 'red'});
CurrentOrbit.addTo(mymap)
}
</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>