"CZML" extrude live animation error

hello
It was done like this in cesium 1.100 version, but it’s not enough for extrude. Please help me with how I can solve it.

  
  let czml = "";
  setInterval(function () { 
    $.ajax({
      type: "GET",
      url: "/data",
      data: JSON, // Json
      success: function (res) {
        czml = res;
        const dataSource = new CzmlDataSource();

        function scaleProperty(property, scalingFactor) {
          // returns a property that scales another property by a constant factor.
          return new CallbackProperty(function (time, result) {
            result = property.getValue(time, result);
            result = result * scalingFactor;
            return result;
          }, property.isConstant);
        }

        function setExtrudedHeight(propertyName) {
          const customPropertyObject = dataSource.entities.getById(
            "water_extrudedheight"
          );
          const property = customPropertyObject.properties[propertyName];
          const colorado = dataSource.entities.getById("colorado");

          colorado.polygon.extrudedHeight = scaleProperty(property, 1);
        }

        // Custom properties can be used as the value of graphical properties:

        dataSource.load(czml);
        viewer.dataSources.add(dataSource);
        console.log(czml);
      },
      error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert("not connection.");
      },
    });
  }, 30000); 

That was my mistake

I didn’t include the “loadedPromise” function, and I didn’t create a function that executes “setExtrudedHeight”.


But I ran into a problem. While receiving SQL as ajax, when I try to get another value as CZML, I get error “DeveloperError: normalized result is not a number”. Is there any way to solve it?

Hi @chan

That error can happen due to multiple reasons, such as a division by zero. This is mostly likely a function of the data you are providing to update the geometry. Would it be possible for you to provide a Sandcastle that reproduces this issue?

Regards,
Sam.

thank you @sanjeetsuhag

Cesium

Cesium Sandcastle

The Cesium Sandcastle provides an interactive environment for testing Cesium code.

In server.js, I created a code that changes the time and result values to real-time DB values in the czml file and sends them to cesiumviewer.js.

But when the time value is changed and entered, an error appears.
I used ‘dataSource.process(czml)’ for this problem, but the problem is still the same.

Regards,
chan

2022년 12월 14일 (수) 오전 3:27, Sam Suhag via Cesium Community <notifications@cesium.discoursemail.com>님이 작성:

Hi @sanjeetsuhag

I haven’t solved the problem yet.
I set interval time as 2022-01-01T00:00:00Z/2022-01-02T00:00:00Z for time interpolation
The polygon extrusion said from 2022-01-01 3:40 to 3:50.

Since I saw the problem as an interval time, I wanted to merge the 3:50 to 4:00 polygon extrusion czml afterwards, so I did this.

However, after reading czml for the first time and extruding once, immediately
The normalized result is not a number error appears.

This is the czml code that caused the problem.

        const exresult = [
          {
            id: "document",
            name: "CZML Custom Properties",
            version: "1.0",
            clock: {
              interval: TotalDate2(" 2022-01-01T00:00:00Z/2022-01-02T00:00:00Z"),
              currentTime: date_re1("2022-01-01T03:40:00Z"),
              multiplier: 300,
            },
          },
          {
            id: "water_extrudedheight",
            name: "An object with custom properties",
            properties: {
              constant_property: true,
              population_sampled: {
                number: [date_re1("2022-01-01T03:40:00Z"), result6[0](300), date_re2("2022-01-01T03:50:00Z"), result6[1](500)],
              },
            },
          },
          {
            id: "colorado",
            name: "Colorado",
            polygon: {
              positions: {
                cartographicDegrees: [
                  128.818153,
                  37.699167,
                  0,
                  128.189289,
                  37.698488,
                  0,
                  128.818186,
                  37.696908,
                  0,
                  128.814783,
                  37.697982,
                  0,
                ],
              },
              material: {
                solidColor: {
                  color: {
                    rgba: [0, 255, 0, 150],
                  },
                },
              },
              height: 208.652,
              extrudedHeight: 208.652,
            },
          },
        ];         

Can you tell me why?

Regards,
Chan