Created
January 16, 2019 01:51
-
-
Save wgaylord/18ad93cb7357c05256fda8b33d7309ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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="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'); | |
var satrec = satellite_js.twoline2satrec("1 43596U 98067PH 19015.50983555 .00007848 00000-0 11252-3 0 9994","2 43596 51.6403 38.6029 0003439 253.6699 106.3915 15.57180304 23784"); | |
getObrit() | |
function getObrit(){ | |
satelliteOrbit = [] | |
for (var i = 0; i < 300; i++){ | |
time = moment().add(i*10,"m") | |
var gmst = satellite_js.gstime(new Date(time.valueOf())); | |
var positionAndVelocity = satellite_js.propagate(satrec, new Date(time.valueOf())); | |
var positionEci = positionAndVelocity.position | |
var positionGd = satellite_js.eciToGeodetic(positionEci, gmst) | |
var curLat = degress(positionGd.latitude) | |
var curLng = degress(positionGd.longitude) | |
var height = positionGd.height | |
satelliteOrbit = satelliteOrbit.concat([curLng, curLat, height*100]); | |
} | |
viewer.entities.add({ | |
id: 1, | |
name: 'Orbit Polyline', | |
polyline: { | |
positions: Cesium.Cartesian3.fromDegreesArrayHeights(satelliteOrbit), | |
width: 5, | |
followSurface: false, | |
material: new Cesium.Material({fabric : { type : 'Color', uniforms : {color : new Cesium.Color(1.0, 1.0, 0.0, 1.0)}}}), | |
} | |
}); | |
} | |
function degress (radians) { | |
return radians * 180 / Math.PI; | |
}; | |
</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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment