CZML dynamic interpolation

Hello!

We have a live data feed which creates CZML and feeds the globe.
Each data point is created with interpolation set to LINEAR, but we would like to disable the interpolation when the data points are, let's say, more than 1 hour separated from each other.

We've thought on using 'availability' to solve this, but it will not work because the feed may not send the data points sorted and also does not have the knowledge of the full picture (it's live data).

We are currently thinking on a solution which would evaluate each new point on a CzmlDataSource updater by getting its neighbors and disable, or not, accordingly to their time delta:
- if the data points delta it's bigger than 1 hour do not interpolate
- else use interpolation

The question is: is it possible to, efficiently, get the next and previous data point of an entity at a given time and change the interpolation value?

Many Thanks
Regards,

sexta-feira, 1 de Fevereiro de 2019 às 17:49:37 UTC, andrea...@gmail.com escreveu:

Hello!

We have a live data feed which creates CZML and feeds the globe.
Each data point is created with interpolation set to LINEAR, but we would like to disable the interpolation when the data points are, let's say, more than 1 hour separated from each other.

We've thought on using 'availability' to solve this, but it will not work because the feed may not send the data points sorted and also does not have the knowledge of the full picture (it's live data).

We are currently thinking on a solution which would evaluate each new point on a CzmlDataSource updater by getting its neighbors and disable, or not, accordingly to their time delta:
- if the data points delta it's bigger than 1 hour do not interpolate
- else use interpolation

The question is: is it possible to, efficiently, get the next and previous data point of an entity at a given time and change the interpolation value?

Many Thanks
Regards,

I meant 'interval' not availability.

Can anyone help with this one?
What I only need is to get the next and previous Property at a given moment.

Regards.

Cesium doesn’t hold onto the packets so unless you’re keeping track of them yourself I don’t think there’d be a way to do that.

Just to make sure I understand, what you’re trying to do is push updates to an entity’s position (using something like SampledProperty?) but once a new update comes in, if it’s been more than hour since the last, don’t interpolate, start a new “segment” of the entity’s path.

If so, you should be able to do this with the TimeIntervalCollection property whose intervals contain SampledProperty instances. So you would be pushing positions into the current SampledProperty, unless a new updates comes in after an hour, in which case you would start a new interval and push that into the collection. This new interval would end at infinity and start at the new data point. This way, a single Entity instance can store multiple segments that aren’t interpolated in between.

Another way to do this would be to create multiple entities instead of re-using the same entity and show/hide the appropriate one.

Let me know if that helps. It might also be helpful to put together a simple Sandcastle of how you have your entity/update step setup that I can look at to see if there’s an easier way to do this as well.

Thanks for the reply!

Yes that's it, but there's an extra catch: the data will not be sorted on receive. This means that I need to rebuild the related SampledProperties accordingly.

Anyway, regarding your suggestion, you mean TimeIntervalCollectionProperty right? And what do you mean by "current SampledProperty"?
Can I get an existing SampledProperty by time, I mean, get the "nearest" SampledProperty on a given moment so I can decide what to do with the received position?

Thanks again,

segunda-feira, 11 de Fevereiro de 2019 às 14:35:50 UTC, Omar Shehata escreveu:

segunda-feira, 11 de Fevereiro de 2019 às 17:28:11 UTC, andrea...@gmail.com escreveu:

Thanks for the reply!

Yes that's it, but there's an extra catch: the data will not be sorted on receive. This means that I need to rebuild the related SampledProperties accordingly.

Anyway, regarding your suggestion, you mean TimeIntervalCollectionProperty right? And what do you mean by "current SampledProperty"?
Can I get an existing SampledProperty by time, I mean, get the "nearest" SampledProperty on a given moment so I can decide what to do with the received position?

Thanks again,

segunda-feira, 11 de Fevereiro de 2019 às 14:35:50 UTC, Omar Shehata escreveu:
> Cesium doesn't hold onto the packets so unless you're keeping track of them yourself I don't think there'd be a way to do that.
>
>
> Just to make sure I understand, what you're trying to do is push updates to an entity's position (using something like SampledProperty?) but once a new update comes in, if it's been more than hour since the last, don't interpolate, start a new "segment" of the entity's path.
>
>
> If so, you should be able to do this with the TimeIntervalCollection property whose intervals contain SampledProperty instances. So you would be pushing positions into the current SampledProperty, unless a new updates comes in after an hour, in which case you would start a new interval and push that into the collection. This new interval would end at infinity and start at the new data point. This way, a single Entity instance can store multiple segments that aren't interpolated in between.
>
>
> Another way to do this would be to create multiple entities instead of re-using the same entity and show/hide the appropriate one.
>
>
> Let me know if that helps. It might also be helpful to put together a simple Sandcastle of how you have your entity/update step setup that I can look at to see if there's an easier way to do this as well.
>
> On Tuesday, February 5, 2019 at 8:51:56 AM UTC-5, andrea...@gmail.com wrote:sexta-feira, 1 de Fevereiro de 2019 às 17:49:37 UTC, andrea...@gmail.com escreveu:
>
> > Hello!
>
> >
>
> > We have a live data feed which creates CZML and feeds the globe.
>
> > Each data point is created with interpolation set to LINEAR, but we would like to disable the interpolation when the data points are, let's say, more than 1 hour separated from each other.
>
> >
>
> > We've thought on using 'availability' to solve this, but it will not work because the feed may not send the data points sorted and also does not have the knowledge of the full picture (it's live data).
>
> >
>
> > We are currently thinking on a solution which would evaluate each new point on a CzmlDataSource updater by getting its neighbors and disable, or not, accordingly to their time delta:
>
> > - if the data points delta it's bigger than 1 hour do not interpolate
>
> > - else use interpolation
>
> >
>
> > The question is: is it possible to, efficiently, get the next and previous data point of an entity at a given time and change the interpolation value?
>
> >
>
> > Many Thanks
>
> > Regards,
>
>
>
> I meant 'interval' not availability.
>
>
>
> Can anyone help with this one?
>
> What I only need is to get the next and previous Property at a given moment.
>
>
>
> Regards.

Hi again,

I am not being able to use SampledPositionProperty on TimeIntervalCollectionPositionProperty. It let me add, but then it fails when retrieving the value.

here's my code:
<code>

entity.position = new Cesium.TimeIntervalCollectionPositionProperty();

var samplePositionProperty = new Cesium.SampledPositionProperty();
                        samplePositionProperty.setInterpolationOptions({
                            interpolationDegree : 1,
                            interpolationAlgorithm : Cesium.LinearApproximation
                        });
samplePositionProperty.backwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
samplePositionProperty.forwardExtrapolationType = Cesium.ExtrapolationType.HOLD;
                        
samplePositionProperty.addSample(timeJulianDate, positionCartesian3);

var stop = new Cesium.JulianDate();
stop = Cesium.JulianDate.addHours(timeJulianDate, 1, stop);
var timeInterval = new Cesium.TimeInterval({
                            start : timeJulianDate,
                            stop : stop,
                            isStartIncluded : false,
                            isStopIncluded : false,
                            data : samplePositionProperty
                        });
entity.position.intervals.addInterval(timeInterval);
</code>

Cesium seems to expect a Cartesian3 on data, not a SampledProperty.
Here's the error:
<code>
Cesium.js:243802 An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: Expected value to be typeof number, actual typeof was undefined
Error
    at new DeveloperError (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:540:19)
    at Object.Check.typeOf.number (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:1793:19)
    at Function.EncodedCartesian3.encode (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:39390:30)
    at Function.EncodedCartesian3.fromCartesian (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:39443:27)
    at writePositionSizeAndOutline (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:123245:27)
    at writePointPrimitive (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:123391:9)
    at PointPrimitiveCollection.update (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:123505:21)
    at EntityCluster.update (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:124764:35)
    at PrimitiveCollection.update (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:131873:27)
    at PrimitiveCollection.update (http://localhost:8080/GeoC2/libs/cesium_unminified/Cesium.js:131873:27)
</code>

My bad, it looks like TimeIntervalCollectionPositionProperty does indeed expect the data to be Cartesian3. Using CompositePositionProperty instead will allow you to compose properties this way.

Here’s a Sandcastle example I just put together to test this.