CZML time interval (w/ no stop time)?

Is it possible to specify a TimeInterval with a start time but no stop time? For example we have some KML with only a begin time (no end time). The ideal result would be that all objects’ stop time would simply be the latest start time.
Right now we are doing the traditional “new JulianDate(GregorianDate.MaxValue)” but then our time slider goes until the year ~2300. We would like to avoid this huge time slider range from 2012 to 2300. Any ideas?

KML:

2011

You are setting up the interval correctly. The problem is that the
computeAvailability function in DynamicObjectCollection and
CompositeDynamicObjectCollection isn't taking open-ended intervals
like this into account. It should ignore the edge cases so that the
computed interval only contains time-limited data.

Can you try replacing the implementation with the below? This should
fix your problem. I'll also open a pull request to fix this in
master.

    CompositeDynamicObjectCollection.prototype.computeAvailability =
function() {
        var startTime = Iso8601.MAXIMUM_VALUE;
        var stopTime = Iso8601.MINIMUM_VALUE;
        var i;
        var len;
        var collection;
        var collections = this._collections;
        for (i = 0, len = collections.length; i < len; i++) {
            collection = collections[i];
            var availability = collection.computeAvailability();
            if (availability.start.lessThan(startTime) &&
!availability.start.equals(Iso8601.MINIMUM_VALUE)) {
                startTime = availability.start;
            }
            if (availability.stop.greaterThan(stopTime) &&
!availability.stop.equals(Iso8601.MAXIMUM_VALUE)) {
                stopTime = availability.stop;
            }
        }
        if (startTime !== Iso8601.MAXIMUM_VALUE && stopTime !==
Iso8601.MINIMUM_VALUE) {
            return new TimeInterval(startTime, stopTime, true, true);
        }
        return new TimeInterval(Iso8601.MINIMUM_VALUE,
Iso8601.MAXIMUM_VALUE, true, true);
    };

    DynamicObjectCollection.prototype.computeAvailability = function() {
        var startTime = Iso8601.MAXIMUM_VALUE;
        var stopTime = Iso8601.MINIMUM_VALUE;
        var i;
        var len;
        var object;
        var dynamicObjects = this._array;
        for (i = 0, len = dynamicObjects.length; i < len; i++) {
            object = dynamicObjects[i];
            if (typeof object.availability !== 'undefined') {
                if (object.availability.start.lessThan(startTime) &&
!object.availability.start.equals(Iso8601.MINIMUM_VALUE)) {
                    startTime = object.availability.start;
                }
                if (object.availability.stop.greaterThan(stopTime) &&
!object.availability.stop.equals(Iso8601.MAXIMUM_VALUE)) {
                    stopTime = object.availability.stop;
                }
            }
        }
        if (startTime !== Iso8601.MAXIMUM_VALUE && stopTime !==
Iso8601.MINIMUM_VALUE) {
            return new TimeInterval(startTime, stopTime, true, true);
        }
        return new TimeInterval(Iso8601.MINIMUM_VALUE,
Iso8601.MAXIMUM_VALUE, true, true);
    };

I just opened a pull request with the complete fix, see
https://github.com/AnalyticalGraphicsInc/cesium/pull/237

Thanks for the update Matthew.

In my example, I am testing with a us_states.kml example which has only a TimeSpan with no . If there is no endTime, the czml-writer was using JulianDate end = new JulianDate(GregorianDate.MaxValue);

Due to the czml-writer translation to GregorianDate.MaxValue, when I load it into Cesium, the end of the timeline becomes like the year 2799. Is there any way to make the endTime be equal to the last startTime? Should that be handled in the czml-writer or in Cesium?

https://developers.google.com/kml/documentation/us_states.kml

Thanks again!

Does anyone have any ideas on how to best handle the case if you have a KML TimeSpan with only a and no time? Should it be taken care of in the KML->CZML converter or within Cesium itself?

Thanks!

Hi Ashley,

Sorry that I never got back to you on your previous email. You are correct, czml-writer does not output the canonical “infinite” value due to the way MinValue and MaxValue are implemented. I would definitely consider this a bug. I will look into this ASAP to see how hard it is to fix. If we run into a problem on the czml-writer side, we can always tweak the “infinite” interval on the client side as well to make sure they both match. I’ll keep you posted when I look into this this evening or tomorrow morning.

Matt

I realized I never replied to let you know that this issue should be completely fixed now. See https://github.com/AnalyticalGraphicsInc/czml-writer/pull/32 for details.