How to get Cartesian3Velocity back out?

I have a CZML Data source with cartesianVelocities in it–how can I access the dX, dY, dZ values…?

You should be able to get the entity by ID, then access its properties. Everything in the CZML API should be mirrored in the Entity API.

There’s an example of retrieving an entity from a loaded CZML here:

viewer.trackedEntity = vehicleEntity = dataSource.entities.getById('Vehicle');

My issue though isn’t finding the entity, but on getting the velocity data out of a SampledPositionProperty: Seemingly with .getValue you can only get back the
position given a time, but I don’t see any way of getting the derivatives of a property…


The value you’re calling .getValue() on is itself the position property over time.

If you want to compute the velocity of this position propety, create a Velocity Property and pass that sampled position property to it: This is how it’s done in this Sandcastle:

That’s what I ended up doing, though from a memory standpoint having the data be in there twice doesn’t seem ideal–as it’s storing the derivatives values in position._property._values, there’s just seemingly no API way to get them back out. :frowning:

I think it just uses a reference, so no data is duplicated.