Update sourcecode to latest and also add lib to pip
parent
430e892de7
commit
1be86842ec
|
@ -5,3 +5,4 @@ satellitetle>=0.5.1
|
||||||
tqdm>=4.30.0
|
tqdm>=4.30.0
|
||||||
skyfield>=1.10
|
skyfield>=1.10
|
||||||
numpy >=1.16
|
numpy >=1.16
|
||||||
|
-e git+https://gitlab.com/librespacefoundation/satnogs/python-satnogs-api@e20a7d3c98526edb55f0dd20f58a4295f09a7bff
|
21
satnogs.py
21
satnogs.py
|
@ -38,7 +38,7 @@ def getFuture():
|
||||||
global TLEs
|
global TLEs
|
||||||
observations = defaultdict(dict)
|
observations = defaultdict(dict)
|
||||||
start = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S%z')
|
start = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||||
end = (datetime.utcnow() + timedelta(hours=4, minutes=30))
|
end = (datetime.utcnow() + timedelta(hours=1))
|
||||||
end = end.strftime('%Y-%m-%dT%H:%M:%S%z')
|
end = end.strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||||
passes = get_paginated_endpoint("https://network.satnogs.org/api/jobs/")
|
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)
|
obs = get_paginated_endpoint("https://network.satnogs.org/api/observations/?end="+end+"&format=json&start="+start)
|
||||||
|
@ -106,7 +106,7 @@ 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)))
|
||||||
|
|
||||||
|
|
||||||
@scheduler.scheduled_job('interval', days=5)
|
@scheduler.scheduled_job('interval', days=1)
|
||||||
def updateTransmitters():
|
def updateTransmitters():
|
||||||
global Transmitters
|
global Transmitters
|
||||||
print("Updating Transmitters")
|
print("Updating Transmitters")
|
||||||
|
@ -119,9 +119,10 @@ def updateTransmitters():
|
||||||
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>'
|
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)
|
@scheduler.scheduled_job('interval', minutes=15)#hours=1)
|
||||||
def updatePasses():
|
def updatePasses():
|
||||||
getFuture()
|
getFuture()
|
||||||
|
updateCZML()
|
||||||
|
|
||||||
|
|
||||||
@scheduler.scheduled_job('interval', hours=1)
|
@scheduler.scheduled_job('interval', hours=1)
|
||||||
|
@ -131,7 +132,7 @@ def updateStations():
|
||||||
Stations = GetGroundStations()
|
Stations = GetGroundStations()
|
||||||
|
|
||||||
|
|
||||||
@scheduler.scheduled_job('interval', minutes=30)
|
#@scheduler.scheduled_job('interval', minutes=5)
|
||||||
def updateCZML():
|
def updateCZML():
|
||||||
global CZMLOnline
|
global CZMLOnline
|
||||||
global CZMLOffline
|
global CZMLOffline
|
||||||
|
@ -193,9 +194,9 @@ def updateCZML():
|
||||||
sat["position"]["interpolationAlgorithm"] = "LAGRANGE"
|
sat["position"]["interpolationAlgorithm"] = "LAGRANGE"
|
||||||
sat["position"]["interpolationDegree"] = 5
|
sat["position"]["interpolationDegree"] = 5
|
||||||
sat["position"]["epoch"] = (y["start"].isoformat()+"Z").replace("+00:00", "")
|
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["path"] = {"show": {"interval": (y["start"].isoformat()+"Z").replace("+00:00", "") + "/" + ((y["end"]).isoformat()+"Z").replace("+00:00", ""), "boolean": True}, "width": 2, "material": {"solidColor": {"color": {"rgba": [0, 255, 0, 255]}}}, "leadTime": 100000, "trailTime": 100000}
|
||||||
|
|
||||||
while temp <= y["end"] + timedelta(minutes=1):
|
while temp <= y["end"] + timedelta(seconds=1):
|
||||||
subpoint = satObj.at(ts.utc(temp)).subpoint()
|
subpoint = satObj.at(ts.utc(temp)).subpoint()
|
||||||
lat = subpoint.latitude.degrees
|
lat = subpoint.latitude.degrees
|
||||||
lng = subpoint.longitude.degrees
|
lng = subpoint.longitude.degrees
|
||||||
|
@ -220,7 +221,7 @@ def updateCZML():
|
||||||
if str(y["id"]) in AliveSats:
|
if str(y["id"]) in AliveSats:
|
||||||
sat = {}
|
sat = {}
|
||||||
sat["id"] = str(y["id"])+"Link"
|
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": 2, "material": {"solidColor": {"color": {"rgba": y["transmitter"][1]}}}, "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(seconds=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"]}}
|
||||||
if StationsByID[y["station"]]["status"] =="Testing":
|
if StationsByID[y["station"]]["status"] =="Testing":
|
||||||
CZMLTesting.append(sat)
|
CZMLTesting.append(sat)
|
||||||
else:
|
else:
|
||||||
|
@ -313,10 +314,10 @@ def api_station(station_id):
|
||||||
sat["position"]["interpolationAlgorithm"] = "LAGRANGE"
|
sat["position"]["interpolationAlgorithm"] = "LAGRANGE"
|
||||||
sat["position"]["interpolationDegree"] = 5
|
sat["position"]["interpolationDegree"] = 5
|
||||||
sat["position"]["epoch"] = (y["start"].isoformat() + "Z").replace("+00:00", "")
|
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["path"] = {"show": {"interval": (y["start"].isoformat()+"Z").replace("+00:00", "") + "/" + ((y["end"]).isoformat() + "Z").replace("+00:00", ""), "boolean": True}, "width": 2, "material": {"solidColor": {"color": {"rgba": [0, 255, 0, 255]}}}, "leadTime": 100000, "trailTime": 1}
|
||||||
|
|
||||||
|
|
||||||
while temp <= y["end"]+timedelta(minutes=1):
|
while temp <= y["end"]:
|
||||||
subpoint = satObj.at(ts.utc(temp)).subpoint()
|
subpoint = satObj.at(ts.utc(temp)).subpoint()
|
||||||
lat = subpoint.latitude.degrees
|
lat = subpoint.latitude.degrees
|
||||||
lng = subpoint.longitude.degrees
|
lng = subpoint.longitude.degrees
|
||||||
|
@ -333,7 +334,7 @@ def api_station(station_id):
|
||||||
if str(y["id"]) in AliveSats:
|
if str(y["id"]) in AliveSats:
|
||||||
sat = {}
|
sat = {}
|
||||||
sat["id"] = str(y["id"])+"Link"
|
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": 2, "material": {"solidColor": {"color": {"rgba": y["transmitter"][1]}}}, "followSurface": False, "positions": {"references": [str(y["id"]) + "#position", str(station_id) + "#position"]}}
|
sat["polyline"] = {"show": {"interval": (y["start"].isoformat()+"Z").replace("+00:00", "") + "/" + ((y["end"]).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(station_id) + "#position"]}}
|
||||||
czml.append(sat)
|
czml.append(sat)
|
||||||
return json.dumps(czml)
|
return json.dumps(czml)
|
||||||
|
|
||||||
|
|
|
@ -1,161 +0,0 @@
|
||||||
#From https://gitlab.com/librespacefoundation/satnogs/python-satnogs-api also under AGPL
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import re
|
|
||||||
|
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
NETWORK_DEV_BASE_URL = 'https://network-dev.satnogs.org'
|
|
||||||
NETWORK_BASE_URL = 'https://network.satnogs.org'
|
|
||||||
DB_BASE_URL = 'https://db.satnogs.org'
|
|
||||||
DB_DEV_BASE_URL = 'https://db-dev.satnogs.org'
|
|
||||||
|
|
||||||
|
|
||||||
def get_paginated_endpoint(url, max_entries=None):
|
|
||||||
r = requests.get(url=url)
|
|
||||||
r.raise_for_status()
|
|
||||||
|
|
||||||
data = r.json()
|
|
||||||
|
|
||||||
while 'next' in r.links and (not max_entries or len(data) < max_entries):
|
|
||||||
next_page_url = r.links['next']['url']
|
|
||||||
|
|
||||||
r = requests.get(url=next_page_url)
|
|
||||||
r.raise_for_status()
|
|
||||||
|
|
||||||
data.extend(r.json())
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_observation_data_from_id(norad_id, start, end, prod=True):
|
|
||||||
# Get all observations of the satellite
|
|
||||||
# with the given `norad_id` in the given timeframe
|
|
||||||
# https://network.satnogs.org/api/observations/?satellite__norad_cat_id=25544&start=2018-06-10T00:00&end=2018-06-15T00:00
|
|
||||||
|
|
||||||
query_str = '{}/api/observations/' \
|
|
||||||
'?satellite__norad_cat_id={}&start={}&end={}'
|
|
||||||
|
|
||||||
url = query_str.format(NETWORK_BASE_URL if prod else NETWORK_DEV_BASE_URL,
|
|
||||||
norad_id,
|
|
||||||
start.isoformat(),
|
|
||||||
end.isoformat())
|
|
||||||
|
|
||||||
observations = get_paginated_endpoint(url)
|
|
||||||
|
|
||||||
# Current prod is broken and can't filter on NORAD ID correctly,
|
|
||||||
# use client-side filtering instead
|
|
||||||
observations = list(observation for observation in observations
|
|
||||||
if observation['norad_cat_id'] == norad_id)
|
|
||||||
|
|
||||||
return observations
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_observation_data(observation_ids, prod=True):
|
|
||||||
# Get station location from the observation via the observation_id
|
|
||||||
|
|
||||||
observations = []
|
|
||||||
for observation_id in observation_ids:
|
|
||||||
base_url = (NETWORK_BASE_URL if prod else NETWORK_DEV_BASE_URL)
|
|
||||||
r = requests.get(url='{}/api/observations/{}/'.format(base_url,
|
|
||||||
observation_id))
|
|
||||||
r.raise_for_status()
|
|
||||||
observations.append(r.json())
|
|
||||||
|
|
||||||
return observations
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_ground_station_data(ground_station_ids, prod=True):
|
|
||||||
# Fetch ground station metadata from network
|
|
||||||
ground_stations = []
|
|
||||||
for ground_station_id in ground_station_ids:
|
|
||||||
# Skip frames from deleted groundstations, indidcated as ID 'None'
|
|
||||||
if str(ground_station_id) == 'None':
|
|
||||||
print("Skipping groundstation 'None'.")
|
|
||||||
continue
|
|
||||||
|
|
||||||
base_url = (NETWORK_BASE_URL if prod else NETWORK_DEV_BASE_URL)
|
|
||||||
r = requests.get(url='{}/api/stations/{}/'.format(base_url,
|
|
||||||
ground_station_id))
|
|
||||||
r.raise_for_status()
|
|
||||||
|
|
||||||
ground_stations.append(r.json())
|
|
||||||
return ground_stations
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_satellite_data(norad_cat_id):
|
|
||||||
# Fetch satellite metadata from network
|
|
||||||
r = requests.get(url='{}/api/satellites/{}/'.format(DB_BASE_URL,
|
|
||||||
norad_cat_id))
|
|
||||||
r.raise_for_status()
|
|
||||||
|
|
||||||
return r.json()
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_tle_of_observation(observation_id, prod=True):
|
|
||||||
base_url = (NETWORK_BASE_URL if prod else NETWORK_DEV_BASE_URL)
|
|
||||||
url = '{}/observations/{}/'.format(base_url,
|
|
||||||
observation_id)
|
|
||||||
r = requests.get(url=url)
|
|
||||||
observation_page_html = r.text
|
|
||||||
|
|
||||||
regex = r"<pre>1 (.*)<br>2 (.*)</pre>"
|
|
||||||
matches = re.search(regex, observation_page_html)
|
|
||||||
|
|
||||||
obs_tle_2 = '1 ' + matches.group(1)
|
|
||||||
obs_tle_3 = '2 ' + matches.group(2)
|
|
||||||
|
|
||||||
return [obs_tle_2, obs_tle_3]
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_telemetry(norad_id, url):
|
|
||||||
# http://db-dev.satnogs.org/api/telemetry/?satellite=43595
|
|
||||||
|
|
||||||
query_str = '{}/api/telemetry/?satellite={}'
|
|
||||||
|
|
||||||
url = query_str.format(url, norad_id)
|
|
||||||
|
|
||||||
telemetry = get_paginated_endpoint(url)
|
|
||||||
|
|
||||||
return telemetry
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_transmitters(norad_id, url):
|
|
||||||
# http://db-dev.satnogs.org/api/transmitters/?satellite__norad_cat_id=25544
|
|
||||||
|
|
||||||
query_str = '{}/api/transmitters/?satellite__norad_cat_id={}'
|
|
||||||
|
|
||||||
url = query_str.format(url, norad_id)
|
|
||||||
|
|
||||||
transmitters = get_paginated_endpoint(url)
|
|
||||||
return transmitters
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_satellites(max_entries, url):
|
|
||||||
query_str = '{}/api/satellites/'
|
|
||||||
url = query_str.format(url)
|
|
||||||
|
|
||||||
satellites = get_paginated_endpoint(url, max_entries=max_entries)
|
|
||||||
return satellites
|
|
||||||
|
|
||||||
|
|
||||||
def post_telemetry(norad_id,
|
|
||||||
source, # Receiver Callsign
|
|
||||||
lon,
|
|
||||||
lat,
|
|
||||||
timestamp,
|
|
||||||
frame,
|
|
||||||
base_url=DB_DEV_BASE_URL):
|
|
||||||
payload = {'noradID': norad_id,
|
|
||||||
'source': source,
|
|
||||||
'timestamp': timestamp,
|
|
||||||
'latitude': lat,
|
|
||||||
'longitude': lon,
|
|
||||||
'frame': frame}
|
|
||||||
|
|
||||||
url = '{}/api/telemetry/'.format(base_url)
|
|
||||||
r = requests.post(url, data=payload)
|
|
||||||
|
|
||||||
if r.status_code != 201:
|
|
||||||
print('ERROR {}: {}'.format(r.status_code, r.text))
|
|
|
@ -1,6 +1,6 @@
|
||||||
<head>
|
<head>
|
||||||
<script src="https://cesiumjs.org/releases/1.53/Build/Cesium/Cesium.js"></script>
|
<script src="https://cesiumjs.org/releases/1.57/Build/Cesium/Cesium.js"></script>
|
||||||
<link href="https://cesiumjs.org/releases/1.53/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
|
<link href="https://cesiumjs.org/releases/1.57/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="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
||||||
document.getElementById("online").checked = true;
|
document.getElementById("online").checked = true;
|
||||||
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwYmEwOTc5YS01N2I3LTRhYmQtOGE0MS1lNTkyMWU2ZmM3YWUiLCJpZCI6Njg1OCwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0NzU5ODkxOX0.p4alNyuyt_Eufuo8xX_SB6HKHuSixBTxgiVpD6UGI3Y';
|
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});
|
var viewer = new Cesium.Viewer('cesiumContainer',{shadows:true,timeline:false,vrButton:false,homeButton:false,animation:true,baseLayerPicker:false,navigationInstructionsInitiallyVisible:false,navigationHelpButton:false});
|
||||||
viewer.terrainProvider = Cesium.createWorldTerrain();
|
viewer.terrainProvider = Cesium.createWorldTerrain();
|
||||||
viewer.scene.globe.shadows=Cesium.ShadowMode.CAST_ONLY
|
viewer.scene.globe.shadows=Cesium.ShadowMode.CAST_ONLY
|
||||||
viewer.scene.globe.enableLighting = true
|
viewer.scene.globe.enableLighting = true
|
||||||
|
@ -49,24 +49,31 @@
|
||||||
viewer.clock.shouldAnimate = true
|
viewer.clock.shouldAnimate = true
|
||||||
|
|
||||||
|
|
||||||
|
const download = async () => {
|
||||||
|
Online = await Cesium.CzmlDataSource.load("/czml")
|
||||||
|
Offline = await Cesium.CzmlDataSource.load("/czmloff")
|
||||||
|
Testing = await Cesium.CzmlDataSource.load("/czmltest")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
|
|
||||||
Online = Cesium.CzmlDataSource.load("/czml")
|
download()
|
||||||
Offline = Cesium.CzmlDataSource.load("/czmloff")
|
update()
|
||||||
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
|
||||||
|
}, 1000*60*30);
|
||||||
|
|
||||||
}, 1000*60*60);
|
|
||||||
|
|
||||||
function update(){
|
function update(){
|
||||||
viewer.dataSources.removeAll()
|
viewer.dataSources.removeAll()
|
||||||
if(document.getElementById("online").checked == true){
|
if(document.getElementById("online").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czml"))
|
viewer.dataSources.add(Online)
|
||||||
}
|
}
|
||||||
if(document.getElementById("offline").checked == true){
|
if(document.getElementById("offline").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czmloff"))
|
viewer.dataSources.add(Offline)
|
||||||
}
|
}
|
||||||
if(document.getElementById("testing").checked == true){
|
if(document.getElementById("testing").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czmltest"))
|
viewer.dataSources.add(Testing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,20 @@
|
||||||
Offline = Cesium.CzmlDataSource.load("/czmloff")
|
Offline = Cesium.CzmlDataSource.load("/czmloff")
|
||||||
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
||||||
document.getElementById("online").checked = true;
|
document.getElementById("online").checked = true;
|
||||||
|
document.getElementById("testing").checked = true;
|
||||||
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwYmEwOTc5YS01N2I3LTRhYmQtOGE0MS1lNTkyMWU2ZmM3YWUiLCJpZCI6Njg1OCwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU0NzU5ODkxOX0.p4alNyuyt_Eufuo8xX_SB6HKHuSixBTxgiVpD6UGI3Y';
|
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});
|
var viewer = new Cesium.Viewer('cesiumContainer',{shadows:true,timeline:false,vrButton:false,homeButton:false,animation:true,sceneModePicker:false,baseLayerPicker:false,navigationInstructionsInitiallyVisible:false,navigationHelpButton:false});
|
||||||
viewer.terrainProvider = Cesium.createWorldTerrain();
|
viewer.terrainProvider = Cesium.createWorldTerrain();
|
||||||
viewer.scene.globe.shadows=Cesium.ShadowMode.CAST_ONLY
|
viewer.scene.globe.shadows=Cesium.ShadowMode.CAST_ONLY
|
||||||
viewer.scene.globe.enableLighting = true
|
viewer.scene.globe.enableLighting = true
|
||||||
viewer.dataSources.add(Online)
|
viewer.dataSources.add(Online)
|
||||||
|
viewer.dataSources.add(Testing)
|
||||||
var now = new Cesium.JulianDate();
|
var now = new Cesium.JulianDate();
|
||||||
viewer.clock.currentTime = now;
|
viewer.clock.currentTime = now;
|
||||||
viewer.clock.shouldAnimate = true
|
viewer.clock.shouldAnimate = true
|
||||||
|
toggle()
|
||||||
temp = 0
|
temp = 0
|
||||||
|
viewer.camera.zoomIn(1000000*4)
|
||||||
|
|
||||||
function icrf(scene, time) {
|
function icrf(scene, time) {
|
||||||
if (scene.mode !== Cesium.SceneMode.SCENE3D) {
|
if (scene.mode !== Cesium.SceneMode.SCENE3D) {
|
||||||
|
@ -73,29 +76,37 @@
|
||||||
|
|
||||||
viewer.scene.postUpdate.addEventListener(icrf);
|
viewer.scene.postUpdate.addEventListener(icrf);
|
||||||
|
|
||||||
|
const download = async () => {
|
||||||
|
Online = await Cesium.CzmlDataSource.load("/czml")
|
||||||
|
Offline = await Cesium.CzmlDataSource.load("/czmloff")
|
||||||
|
Testing = await Cesium.CzmlDataSource.load("/czmltest")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
|
|
||||||
Online = Cesium.CzmlDataSource.load("/czml")
|
download()
|
||||||
Offline = Cesium.CzmlDataSource.load("/czmloff")
|
update()
|
||||||
Testing = Cesium.CzmlDataSource.load("/czmltest")
|
|
||||||
|
|
||||||
}, 1000*60*60);
|
}, 1000*60*30);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function update(){
|
function update(){
|
||||||
viewer.dataSources.removeAll()
|
viewer.dataSources.removeAll()
|
||||||
if(document.getElementById("online").checked == true){
|
if(document.getElementById("online").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czml"))
|
viewer.dataSources.add(Online)
|
||||||
}
|
}
|
||||||
if(document.getElementById("offline").checked == true){
|
if(document.getElementById("offline").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czmloff"))
|
viewer.dataSources.add(Offline)
|
||||||
}
|
}
|
||||||
if(document.getElementById("testing").checked == true){
|
if(document.getElementById("testing").checked == true){
|
||||||
viewer.dataSources.add(Cesium.CzmlDataSource.load("/czmltest"))
|
viewer.dataSources.add(Testing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function toggle(){
|
function toggle(){
|
||||||
viewer.animation.container.hidden = !viewer.animation.container.hidden;
|
viewer.animation.container.hidden = !viewer.animation.container.hidden;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue