Hi,
Please would it be possible to have some advice on retrieving data from a SampledProperty?
First, I’m setting up the clock in the Cesium viewer to cover the period of time in which I am interested:
var start = Cesium.JulianDate.fromIso8601(‘2012-08-04T13:21:40Z’);
var stop = Cesium.JulianDate.fromIso8601(‘2012-08-04T19:08:09Z’);
//Make sure viewer is at the desired time.
viewer.clock.startTime = start.clone();
viewer.clock.stopTime = stop.clone();
viewer.clock.currentTime = start.clone();
viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP; //Loop at the end
viewer.clock.multiplier = 4;
viewer.timeline.zoomTo(start, stop);
``
This function loads two data points into the SampledProperty, with the intention of interpolating between the two extremes:
function paramHdg () {
var propertyx = new Cesium.SampledProperty(Number);
propertyx.addSample(Cesium.JulianDate.fromIso8601(‘2012-08-04T13:21:40Z’), 1.0);
propertyx.addSample(Cesium.JulianDate.fromIso8601(‘2012-08-04T19:08:09Z’), 100.0);
return propertyx;
}
``
The intention of this code is to get back tHdg from the above function and then retrieve an interpolated value (I’ve omitted any ‘vars’ because I was using them as globals during troubleshooting):
var tHdg = paramHdg();
viewer.clock.onTick.addEventListener(function(clock) {
currentTime = clock.currentTime;
hg = tHdg.getValue(currentTime);
// Do something with hg
}
);
``
What have I missed, included or otherwise turned on its head?!
Thanks,
Hugh
(just starting to get to grips with Cesium)