Entity path not showing

Hi,

I’m new to Cesium, company project needs to show multiple satellites and their path.

I tried following code, it show satellite images, but path can’t display, here is the code:

// Compute entity

var entity = new Cesium.Entity({id: sId});

// Availability
entity.availability = new Cesium.TimeIntervalCollection([
    new Cesium.TimeInterval({
        start: Cesium.JulianDate.fromIso8601("2012-03-15T10:00:00Z"),
        stop: Cesium.JulianDate.fromIso8601("2012-03-16T02:40:00Z")
    })]);

// Billboard
entity.billboard = new Cesium.BillboardGraphics();
entity.billboard.image = "/image/satellite.png";
entity.billboard.show = true;

// Position
entity.position = positions;
entity.orientation = new Cesium.VelocityOrientationProperty(positions);

var fadedLine = new Cesium.StripeMaterialProperty({
    evenColor: Cesium.Color.YELLOW,
    oddColor: Cesium.Color.BLACK,
    repeat: 1,
    offset: 0.2,
    orientation: Cesium.StripeOrientation.VERTICAL
});

var path = new Cesium.PathGraphics();
path.material = fadedLine;
path.leadTime = new Cesium.ConstantProperty(0);
path.trailTime = new Cesium.ConstantProperty(3600 * 4);

entity.path = path;

// // Path
// entity.path = new Cesium.PathGraphics({
//     resolution: 1200,
//
//     material: new Cesium.PolylineGlowMaterialProperty({
//                     glowPower: 0.16,
//                     color: Cesium.Color.RED
//                 }),
//     width: new Cesium.ConstantProperty(10),
//     leadTime: new Cesium.ConstantProperty(1e10),
//     trailTime: new Cesium.ConstantProperty(1e10)
// });

// Make a smooth path
entity.position.setInterpolationOptions({
    interpolationDegree : 5,
    interpolationAlgorithm : Cesium.LagrangePolynomialApproximation
});

entityCollection.add(entity);

Above is piece of code to add entity into view.entities.

I tried PolylineGlowMaterialProperty and StripeMaterialProperty, both not showing path.

I also tried Availability time range and leadTIme+trailTime, not working.

Also, when I add Availability time range and leadTime+trailTime, got "array length " exception.

Anyone can help.

Thanks,

John

Forgot to mention the version, I use Cesium.js v 1.35, the latest version.

Thanks,

John

Anyone can help?

Thanks,

John

Hi there,

It looks like you had a problem with the alignment of your time intervals (the availability, and the timeline range. Here’s a working code example: http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=f1c951ba20dc310b38371cab34648abe

Hope that helps,

  • Rachel

Thanks, Rachel.

It works now, I switch coordinate generateor from Cesium.Cartesian3 to Cesium.Cartesian3.FromDegree, and the coordinate format accordingly, not sure it’s bug or not.

Thanks,

John

Hi John,

Sorry, what do you mean? If you still have a bug I would check your conversions.

Best,

  • Rachel