I'm a beginner of Cesium and Javascript code. I need to create the orbit of a satellite (ESEO) around the globe. The satellite have to move according to SGP4 model. How can I create it in Cesium sandcastle? I'm in trouble because I'm not finding any tutorials or examples online that explain how to do it. Right now I have only positioned the ground station where I want on the globe.
var viewer = new Cesium.Viewer ('cesiumContainer', {
scene3DOnly: false,
selectionIndication: false,
baseLayerPicker: true
});
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ODY0ZjkwMy03YmZlLTRlNGEtYmNhOS0xMDBlZGVmNDRkZGMiLCJpZCI6OTE4MSwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU1MzYxMjM5Mn0.aYYX1f1MQfg9zLFu0vnP3A56Neo4Y_N3G2O5tuTS0XM';
// Enable lighting based on sun/moon positions
viewer.scene.globe.enableLighting = true;
//Stazione di terra
var entity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(12.04, 44.23),
ellipse : {
semiMinorAxis : 150000.0,
semiMajorAxis : 150000.0,
material : Cesium.Color.YELLOW.withAlpha(0.5)
}
});
var ellipse = entity.ellipse;
ellipse.material = new Cesium.GridMaterialProperty({
color : Cesium.Color.YELLOW,
cellAlpha : 0.2,
lineCount : new Cesium.Cartesian2(8, 8),
lineThickness : new Cesium.Cartesian2(2.0, 2.0)
});
var GroundStation = viewer.entities.add({
name : 'Ground Station',
position : Cesium.Cartesian3.fromDegrees(12.07, 44.23),
point : {
pixelSize : 5,
color : Cesium.Color.RED,
outlineColor : Cesium.Color.WHITE,
outlineWidth : 2
},
label : {
text : 'Ground Station',
font : '14pt monospace',
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth : 2,
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
pixelOffset : new Cesium.Cartesian2(0, -9)
}
});
I'm a beginner of Cesium and Javascript code. I need to create the orbit of a satellite (ESEO) around the globe. The satellite have to move according to SGP4 model. How can I create it in Cesium sandcastle? I'm in trouble because I'm not finding any tutorials or examples online that explain how to do it. Right now I have only positioned the ground station where I want on the globe.
var viewer = new Cesium.Viewer ('cesiumContainer', {
scene3DOnly: false,
selectionIndication: false,
baseLayerPicker: true
});
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4ODY0ZjkwMy03YmZlLTRlNGEtYmNhOS0xMDBlZGVmNDRkZGMiLCJpZCI6OTE4MSwic2NvcGVzIjpbImFzciIsImdjIl0sImlhdCI6MTU1MzYxMjM5Mn0.aYYX1f1MQfg9zLFu0vnP3A56Neo4Y_N3G2O5tuTS0XM';
// Enable lighting based on sun/moon positions
viewer.scene.globe.enableLighting = true;
//Stazione di terra
var entity = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(12.04, 44.23),
ellipse : {
semiMinorAxis : 150000.0,
semiMajorAxis : 150000.0,
material : Cesium.Color.YELLOW.withAlpha(0.5)
}
});
var ellipse = entity.ellipse;
ellipse.material = new Cesium.GridMaterialProperty({
color : Cesium.Color.YELLOW,
cellAlpha : 0.2,
lineCount : new Cesium.Cartesian2(8, 8),
lineThickness : new Cesium.Cartesian2(2.0, 2.0)
});
var GroundStation = viewer.entities.add({
name : 'Ground Station',
position : Cesium.Cartesian3.fromDegrees(12.07, 44.23),
point : {
pixelSize : 5,
color : Cesium.Color.RED,
outlineColor : Cesium.Color.WHITE,
outlineWidth : 2
},
label : {
text : 'Ground Station',
font : '14pt monospace',
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
outlineWidth : 2,
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
pixelOffset : new Cesium.Cartesian2(0, -9)
}
});
Share
Improve this question
edited Apr 6, 2019 at 12:22
Francesco Mazzeo
asked Apr 6, 2019 at 8:56
Francesco MazzeoFrancesco Mazzeo
612 silver badges6 bronze badges
15
- 1 It's unlikely there would be a tutorial for something quite so specific. But it sounds like basically it's a mathematical model. So there should be some algorithm or calculation to do. Computers are good at maths, and most programming languages, including JavaScript, have lots of maths functions and operators you can use, you just need to look them up. I would first plan out your calculations on paper, and then try to work out how you would make the code perform each calculation, step by step. It's unlikely anyone here will help you until you've at least tried to start it yourself – ADyson Commented Apr 6, 2019 at 9:06
- I've already done the mathemtical model but the problem now is just create the orbit on cesium sandcastle. I don't know how to visualize the paths and the satellite movements on it – Francesco Mazzeo Commented Apr 6, 2019 at 9:16
- So you want to make a graphical display of it, rather than just calculations? I'm not sure that was clear in the question. Have you done the basics of this Cesium tool to work out how to make simple shapes etc? – ADyson Commented Apr 6, 2019 at 9:49
- Yes, the first problem is create a generical orbit using paramethres like period, semi-axis major, eccentricity...like an STK scenario. I'd like to display the path and a point, wich represent the satellite, moving on it. How I've already said, I'm a beginner of Cesium and Javascript, I'm trying to learn using tutorials and examples but about this I couldn't find anyhing. – Francesco Mazzeo Commented Apr 6, 2019 at 9:53
- I used these tutorials on cesium js page: cesium./docs – Francesco Mazzeo Commented Apr 6, 2019 at 10:02
2 Answers
Reset to default 3When people draw orbits in Cesium, they usually use polylines instead of the ellipse entity that you use.
Link to polyline/polyline collection: https://cesiumjs/Cesium/Build/Documentation/Polyline.html
Now with regards to SGP4, this propagator takes in a NORAD two-line element. So if you have your orbital parameters you can create your own TLE. This should be pretty easy to do in an external python program and writing it to a JSON file which can be read into javascript and then passed to the propagator. For more info about TLEs, wikipedia has a good description of how it is formatted.
TLE info: https://en.wikipedia/wiki/Two-line_element_set
For the actual SGP4 implementation, there is a Satellite.js package whose github is linked below. They are able to properly implement a propagator that takes in NORAD TLE's and spits out trajectory information.
Satellite.js github: https://github./shashwatak/satellite-js
I am pretty sure you have to convert the TLE into different parameters you pass into the satellite-js module which propagates it.
When you are doing this, I highly remend creating a worker thread for the code to execute because of the heavy overhead. You do not want to have all your mathematical heavylifting being done along with the graphical rendering of Cesium.
Another note of importance: You absolutely should not need to use SGP4 if you can avoid it. You should create your own propagator that fits the needs of your project. Orbit determination can be tricky but is much better practice than using a propagator meant for NORAD satellite tracking.
You can look at this project for a demonstration of some of the items listed in aaastro's answer.
jspredict
You can also checkout this great paper and supporting source for further explanations on TLE, SGP4, Cesium.
Spacemission
Visualization of Orbital Debris with Cesium and Satellite-js