Hello!
I’m currently working on a project to visualize satellites in GEO and their orbits. I was able to successfully plot the satellites using their x, y, z positions. I’m using satellite.js to calculate that position based off of the satellite’s TLEs.
However, I’m having trouble getting Cesium to display the orbital path. I’m calculating the points along that path in the same way & propagating the satellite forward in time. Which is generating an array that looks like this [x, y, z, x, y, z, x, y, z,...]
. That format works with Cesium.Cartesian3.fromDegreesArrayHeights
and .fromRadiansArrayHeights
, but I don’t see an equivalent if you’re using x, y, z positioning (instead of long, lat, height). I’d be very grateful if someone could point me in the right direction.
const satrec = satellite.twoline2satrec(tle[0], tle[1])
const positionAndVelocity = satellite.propagate(satrec, time)
const positionEci = positionAndVelocity.position
const { x, y, z } = positionEci
let orbit = []
const newTime = time
for (let i = 0; i <= 20; i++) {
// figure out the time
newTime.setMinutes(newTime.getMinutes() + i * 10)
// get the coordinates at the new time
let positionAndVelocity = satellite.propagate(satrec, newTime)
let positionEci = positionAndVelocity.position
const { x, y, z } = positionEci
// update the orbit
orbit = orbit.concat([x, y, z])
}
viewer.entities.add({
id: sat.id,
position: Cesium.Cartesian3.fromElements(
x * 1000,
y * 1000,
z * 1000
),
point: {
pixelSize: 5,
color: Cesium.Color.RED,
outlineColor: Cesium.Color.WHITE,
outlineWiddth: 2
},
polyline: {
positions: Cesium.Cartesian3.fromArray(orbit), // This isn't correct
width: 5,
followSurface: true,
material: Cesium.Color.BLUE
}
})