Per position extrudedHeight, and dynamic filtering/hiding/showing lots of entities


1 - Possible to have a single entity that has a per position extruded height?

We want to display a set of polygons that represent a specific flight path/tunnel but we need to create a segment for each section since the heights could be different. Is there a way we can display the flight path as a single entity or is the approach shown in the Sandcastle the best way to represent what I want?
CZML has a way to set a per position height but not a per position extrudedHeight. We’re displaying 10 flight paths but it ends up being 363 entities to represent all of them completely.

2 - Showing/hiding entities

As you can see the Sandcastle, I am dynamically changing the color of the flight paths whether they are considered active, inactive or in the future. This is not how we want to actually display but is useful for discussion purposes.

We want to have a checkbox for active/inactive/future. If, for example, active is checked, we want to only have the current flight paths that are considered ‘active’ given their properties. If ‘inactive’ is checked, we want to also include any of the inactive flight paths based on the timeline.

The current code is just dynamically setting transparency but this is just a POC and does not seem like the best approach.

I have tried having as a CallbackProperty but that didn’t work (show isn’t a Property) and it’s possible that also wouldn’t do what I would want to do. The documentation does not say if this is called on every tick or not but maybe it is? I’m definitely not a Cesium expert :laughing:

I have thought of possibly updating all the entities show property on each entity by using a listener on viewer.clock.onTick then depending on which which checkboxes are check it will set show to true/false. Is this a valid approach or is there a better way? I was curious how the SatelliteViewer app did it since they are also doing a similar kind of filtering although in my case I need to do it dynamically based on the current clock time.

Another possibility that occurred to me is to call process on the CZML datasource with any of the entities affected and update the property to false/true.

There is also the availability/interval properties too that while they were initially helpful for getting an understanding of CZML and creating a POC, they did not seem to fit entirely into my use case since I want to do filtering that is not time dependent.

I’m intending to also to have a mapped list of each flight path and their related entity IDs too although it is probably only a minor optimization

3 - browser/CPU performance

I’ve noticed I need to close and restart my browser to return to stable performance. Is there something I can do so that is not necessary? Any recommendations? I’m using a 2017 Macbook Pro which is probably part of the problem.

4 - possible minor bug?

By pressing play you can eventually see that it will momentarily show a red flight path before it disappears. In the code, it is supposed to be showing a transparent red polygon. The transparency is applied after the fact…?

It also shows a pink flight path which would only happen if time is undefined – why would time be undefined?

While I’ve worked with Cesium for a couple weeks, there still feels like a lot I don’t know so any guidance would be great!

I couldn’t get the Sandcastle working by importing a gist (it said there were too many requests from my IP??)… and when I try to use the share URL it is ‘too long’ by a couple 100,000 characters.

here is a direct link to the gist that you should be able to copy/paste as a sandcastle.

I’m going to try condensing my questions since it looks like you’re the one who normally answers everything and want to make your job easier.

  1. Fewer entities? Possible to have a single entity that has a per position extruded height? Seems unlikely but looking for ways to simplify what I’m doing currently.

  2. Filtering all entities of a datasource - Ultimately trying to figure out the best way to filter a set of entities based on a checkbox. It seems like using the onTick callback may be the best approach since I could dynamically update all the entities of a datasource on each tick. Maybe there is a better way by perhaps using a Property but didn’t have success using CallbackProperty which I thought might work.

  3. CPU issues – it’s possible there are memory leaks which are not being cleaned up when the tab refreshes but that’s the only thing I can think of right now. Also the main destroy method I had previously is not being triggered in the same way due to some recent code changes.

4 Minor bugs - they seem like they could be real issues

I appreciate the summarized version! One tip when sharing Sandcastles - if you can upload your CZML to Cesium ion, that’ll significantly shorten the shared Sandcastle compared to embedding the data directly.

Looks like the API doesn’t allow that, but it sounds like a useful feature request to me. Can you create a minimal Sandcastle example that shows what you’re attempting to do with your current workaround? That’ll help us open up a GitHub issue for it to see what the other maintainers think.

I don’t think you need to use an onTick. You could just run a function whenever this click event is triggered to loop over all entities and update them. Either way as long as you’re only doing this looping when needed it should be good.

You can use a CallbackProperty for this, but applying a CallbackProperty to any entity marks it as “dynamic” which may incur a significant performance cost if you have a lot of these dynamic entities. Generally better to use this if your entities are moving all the time (like a vehicle etc)

If you can create a minimal Sandcastle example reproducing that that’ll help a lot in determining whether it’s a library issue or something in your app.

I don’t think you need to use an onTick. You could just run a function whenever this click event is triggered to loop over all entities and update them. Either way as long as you’re only doing this looping when needed it should be good.

The issue is that given the current time in the timeline, it will affect the visibility. So if the current time is 4pm then entities in the past are hidden. When the timeline changes from 4pm to 4:01pm there might be more entities which also need to be hidden since they’re now in the past. So, using onTick seems to be the only way to make these time dependent changes.