How to draw orbits? (calculated in JS, not CZML)

I calculate satellite positions (in JS) based on time and render them with a billboard, all working well.

I’d like to be able to show an orbit: I expect I’ll take the orbit’s period and invert to get the time-period I’ll need to render to get a singe orbit. Then I expect I’ll have to render a bunch of segments to get something that looks like an ellipse.

The gorgeous Simple CZML Demo is what I’m thinking of, but I’m calculating positions in JS rather than externally.

Is ‘polyline’ the right approach? If not, what’s the right approach?

Thanks

Chris,

Yes, you can use a polyline for this.

IIRC we usually compute the orbit in an inertial frame and then transform it to fixed at each time step by setting the polyline’s model matrix. To approximate the transform, you could use computeTemeToPseudoFixedMatrix.

Also, just because you are doing computations in JavaScript, doesn’t mean you can’t use CZML. You can dynamically generate CZML. There is better support for orbits in CZML planned so it’s probably worth keeping your eye on it.

Regards,

Patrick

Hi,

Just wondering what’s involved to dynamically generate CZML from JavaScript without using a CesiumViewerWidget. e.g. This is not yet working for me, though it could be a problem elsewhere…

var dynamicObjectCollection = new Cesium.DynamicObjectCollection();
Cesium.processCzml(czml, dynamicObjectCollection);
var vis = Cesium.VisualizerCollection.createCzmlStandardCollection(scene, dynamicObjectCollection);
vis.update(date);

Thanks,
Chris

Chris,

Have you seen the CZML in Cesium wiki page?

Patrick

I have to admit that some of the information on that page has gotten out of date (though a lot of it is still relevant). Right now the DynamicScene layer is kind of a jumble of objects that store time-dynamic data for visualization and objects that parse CZML into them. In the future, I would like to better separate these two concepts to make it easy for people to store time-dynamic data client side regardless of the original source.

Technically, you can do that now by creating JSON objects that represent parsed CZML, but it’s not as easy as having an “addPositions” property on a DynamicPositionProperty for example. If you care about generating “static” orbits, then just use a Polyline and be done with it. If you need lead/trail times where the length of the orbits grow and shrink as the satellite moves, then that gets a little trickier, but ultimately just means efficiently regenerating the Polyline each time.

The good news is that my plate has freed up a bit and I’m going to have more time to work directly on Cesium again. Improving the DynamicScene layer so that it’s more easily usable when not working with server-generated CZML is one of the main things I’ll be looking at.

I hope this sheds some light on where we are at. Maybe I’ll look into writing up a SandCastle example showing how to do client-side generated CZML; this way we have a good example to point to whenever anyone asks about it.

Matt

Thanks Patrick & Matt,

I was out of office so have just got back to this. I managed to get a simple example working now based on the wiki entry. I think a SandCastle example is a good idea as then it will stay up to date. I can clean up mine and contribute it if you haven’t already looked into it. The czml is a stripped back single frame version of Vehicle.czml inlined directly.

Cheers,
Chris

Chris - I don’t work directly with CZML often (err, maybe ever), but this sounds like a welcomed contribution to me.

Patrick

I agree, it’s a great idea. I’m also hoping to spend time in the near future improving both orbits and use of client-side data generation, so your example will serve as a good reference point for that as well.