Lots of data for a single Entity

Hello Everybody,

The what: I’m currently working on a project where I receive lots of sensor data on my server, which I pass to the frontend using WebSockets to visualize it. In this example I am making a single entity that can have hundreds (~600) of points per minute. I would like to show the current position and show where this entity has been (the so called “trailTime”), so I am using a SampledPositionProperty and a PointGraphic in my entity… See below

The problem: I notice that when running this I am getting a slower and slower frame rate as more data is populated within the cesium viewer. I am wondering if I can visualize the “trailTime” and keep my frame rate better?

Note: In this example I am running a single entity but would hope to be able to visualize lot of entities this way. I am not sure this is possible but would want to try before I create CZML files from this data as I would have to learn how to do that. :slight_smile:

Thanks

      {
        id: event.name,
        position: new SampledPositionProperty(),
        point: new PointGraphics({
          color: Color.RED,
          pixelSize: 7,
        }),
        path: new PathGraphics({
          resolution: 1200,
          material: new ColorMaterialProperty(Color.RED),
          width: 2,
          leadTime: 0,
          trailTime: 60 * 90,
        }),
        name: event.name,
        description: JSON.stringify(event, null, 4),
      }

When the websocket receives data I then update the SampledPositionProperty with the add sample method… See below

            e.position.addSample(
              new JulianDate.fromDate(new Date(ws_time / 1_000_000)),
              new Cartesian3(
                x,
                y,
                z
              )
            )

@gerhardatball

Welcome to the community! Thank you very much for your detailed community forum post and your great questions :fireworks: :rocket:

I have come across other questions related to runtime performance when adding significant amounts of data to the Cesium Viewer. Updating time dynamic entities is a pain point for the CesiumJS community as a whole. One high-level suggestion that I have would be to load in all of the entities required for your application pre-emptively. When a “new” entity is needed, you can set show: true on an unused entity and update the position of the entity. This strategy should help improve runtime performance. Are there any suggestions from the rest of the community?

-Sam

Hi Sam,

Thanks for the reply. Not sure I can do that with the design of this. Users can add a “dynamic visual” from the data whenever they want. I am looking at if I adjust the PathGraphics.resolution or the PathGraphics.trailTime values as well to see if that can improve the performance. The resolution is making my brain hurt as I don’t understand it. With so many data points should this be a small number or a big number?

Gets or sets the Property specifying the maximum number of seconds to step when sampling the position.

Also I am looking at if I can run a reducer on the data before hand and so not every single point needs to be sent. Also I tried to not call new Cartesian3 every time the web socket gets a change and in place just update the position, this did not work as it would never update in the viewer.

1 Like

@gerhardatball

Creating a reducer seems like a promising workaround. If made open source, it could help out other community members with similar issues. What is your high-level plan for creating the reducer?

Also, can you please keep me updated on how your experimentation with PathGraphics.resolution and PathGraphics.trialTime are going? Looking forward to learning more.

-Sam

Open Source was approved and you can look over the code here. cosmosc2-tool-planetviewer

I have yet to test more of the PathGraphics.resolution and PathGraphics.trialTime but have allowed the user to enter them as values to make testing easier.

1 Like

@gerhardatball

Looks great - thank you so much for sharing! If you can host this on a server and provide us with a working link we might be interested in sharing this on our social media platforms. Keep me posted :rocket: :ringer_planet:

-Sam