Selecting Orbit Tracks and Getting Position Data

Hello All,

I have been looking into the CZML example in Cesium. I see that it is possible to click to select a satellite that is following an orbit around the Earth. I also see that clicking on the linethat is drawn that represents the orbit track will also select the satellite.

My question is: is it possible to select "orbits" in Cesium and get information, such as ephemeris data back?

I believe that these orbit tracks are defined as "path" objects in the "simple.czml" file using the "leadTime" and "trailTime" properties. Is it possible to get the satellites current position at a given time by clicking on these lines/paths?

Thanks a lot!

To be clear, this is b28. Though a solution in the Cesium release would be great as well.

Here’s a solution for Cesium 1.1. You may have to change “selectedEntity” to “selectedObject”, and “viewerEntityMixin” to “viewerDynamicObjectMixin” (and possibly more changes) to roll it back for b28 compatibility.

Paste this into Sandcastle.

// Launch Cesium Viewer
var viewer = new Cesium.Viewer(‘cesiumContainer’);
viewer.extend(Cesium.viewerEntityMixin);

// Load CZML
var czmlDataSource = new Cesium.CzmlDataSource();
viewer.dataSources.add(czmlDataSource);
czmlDataSource.loadUrl(’…/…/SampleData/simple.czml’);

// Create HUD
var hud = document.getElementById(‘toolbar’);
hud.setAttribute(‘style’, ‘background: rgba(42,42,42,0.9); border-radius: 5px;’);

var cartographic = new Cesium.Cartographic();
viewer.clock.onTick.addEventListener(function(clock) {
var entity = viewer.selectedEntity;
if (!Cesium.defined(entity)) {
hud.style.display = ‘none’;
} else {
hud.style.display = ‘block’;
var position = entity.position.getValue(clock.currentTime);
Cesium.Ellipsoid.WGS84.cartesianToCartographic(position, cartographic);
hud.innerHTML =
‘Lon: ’ + Cesium.Math.toDegrees(cartographic.longitude).toFixed(3) + ’ deg
’ +
‘Lat: ’ + Cesium.Math.toDegrees(cartographic.latitude).toFixed(3) + ’ deg
’ +
‘Alt: ’ + (cartographic.height * 0.001).toFixed(1) + ’ km’;
}
});

// end of example

Ed,

I was able to get this to work in b28 with only those few small changes that you mentioned. This is great. Thanks for the help!