Can I periodically remove czml packets in the CzmlDatasource?

Hi everyone

I’m visualizing thousands of vehicle trails in Cesium using CZML.

I wrote many czml files to record positions of vehicles per minute, and load it periodically by CzmlDatasource.process() function.

The problem is when time goes by, more and more files are loaded and occupy the memory. I can see the memory increases gradually.

Removing the previous loaded czml packets may be a solution, but I don’t know how to.

For example, I firstly load 2 minutes data. When I need the next minute data, I can remove the previous minute data, to assure that there are always only 2 packets in the CzmlDataSource.

So Can I periodically remove czml packets in the CzmlDatasource? Or are there any other solutions to this issue?

Thanks

Chris

Hi Chris,

this should get you started (untested):

for (var i = 0; viewer.dataSources.length > 2; i; i++)

viewer.dataSources.remove(viewer.dataSources.get(0), true);

Hope that helps,

Klaus

Thanks Klaus

However, that won’t work. Because there is only one CzmlDataSource in the viewer.

I use CzmlDatasource.process(packet) to load only position properties in different time period, so that the loaded czml file can be in small size.

That method keeps style property in the first loaded czml file. All the packets are in the same CZMLDataSource.

To be specific, I need to remove entity’s position data in specific time period to reduce memory use.

Chris

在 2017年11月22日星期三 UTC+8下午2:32:13,Klaus Rheinwald写道:

Chris -

Ok, then you need to dig deeper into the dataSource to find the entities and check their timestamp.

This should point you in the right direction:

var entities = viewer.dataSources.get(e).entities.values;

var times = entities[entities.length-1].position._property._times;

with e = 0 in your case.

Klaus

One option is to use a delete packet to remove an entity entirely, and then recreate it specifying only the new set of samples.

https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Packet#properties

This use case, though unusual, has come up before. https://github.com/AnalyticalGraphicsInc/cesium/issues/2520

New CZML syntax to specify that an interval of samples should be deleted would be a useful addition to consider in the future.

segunda-feira, 27 de Novembro de 2017 às 16:35:00 UTC, Scott Hunter escreveu:

One option is to use a delete packet to remove an entity entirely, and then recreate it specifying only the new set of samples.

https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Packet#properties

This use case, though unusual, has come up before. https://github.com/AnalyticalGraphicsInc/cesium/issues/2520

New CZML syntax to specify that an interval of samples should be deleted would be a useful addition to consider in the future.

Hi everyone

I'm visualizing thousands of vehicle trails in Cesium using CZML.

I wrote many czml files to record positions of vehicles per minute, and load it periodically by CzmlDatasource.process() function.

The problem is when time goes by, more and more files are loaded and occupy the memory. I can see the memory increases gradually.

Removing the previous loaded czml packets may be a solution, but I don't know how to.

For example, I firstly load 2 minutes data. When I need the next minute data, I can remove the previous minute data, to assure that there are always only 2 packets in the CzmlDataSource.

So Can I periodically remove czml packets in the CzmlDatasource? Or are there any other solutions to this issue?

Thanks

Chris

--

You received this message because you are subscribed to the Google Groups "cesium-dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi Scott,

regarding the subject's related issue (https://github.com/AnalyticalGraphicsInc/cesium/issues/2520), do you have any prediction when this will be available?

Our goal is to remove all data points in a DataSource out of a given time interval.

Regards.

Feel free to bump the issue on GitHub to let the team know it’s still something you need. It helps to offer more context as well, since the more commonly used a feature will be the more likely it will be a priority.

In the mean time, have you tried using the workaround code provided in that issue to accomplish this?

quinta-feira, 20 de Dezembro de 2018 às 16:58:34 UTC, Omar Shehata escreveu:

Feel free to bump the issue on GitHub to let the team know it's still something you need. It helps to offer more context as well, since the more commonly used a feature will be the more likely it will be a priority.

In the mean time, have you tried using the workaround code provided in that issue to accomplish this?

On Wednesday, December 19, 2018 at 11:55:46 AM UTC-5, andrea...@gmail.com wrote:segunda-feira, 27 de Novembro de 2017 às 16:35:00 UTC, Scott Hunter escreveu:

> One option is to use a delete packet to remove an entity entirely, and then recreate it specifying only the new set of samples.

>

>

> https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Packet#properties

>

>

>

> This use case, though unusual, has come up before. https://github.com/AnalyticalGraphicsInc/cesium/issues/2520

>

>

> New CZML syntax to specify that an interval of samples should be deleted would be a useful addition to consider in the future.

>

>

>

>

>

>

>

>

> Hi everyone

>

>

>

> I'm visualizing thousands of vehicle trails in Cesium using CZML.

>

>

> I wrote many czml files to record positions of vehicles per minute, and load it periodically by CzmlDatasource.process() function.

>

>

> The problem is when time goes by, more and more files are loaded and occupy the memory. I can see the memory increases gradually.

>

>

> Removing the previous loaded czml packets may be a solution, but I don't know how to.

>

>

> For example, I firstly load 2 minutes data. When I need the next minute data, I can remove the previous minute data, to assure that there are always only 2 packets in the CzmlDataSource.

>

>

> So Can I periodically remove czml packets in the CzmlDatasource? Or are there any other solutions to this issue?

>

>

>

> Thanks

>

>

> Chris

>

>

>

>

> --

>

> You received this message because you are subscribed to the Google Groups "cesium-dev" group.

>

> To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.

>

> For more options, visit https://groups.google.com/d/optout.

Hi Scott,

regarding the subject's related issue (https://github.com/AnalyticalGraphicsInc/cesium/issues/2520), do you have any prediction when this will be available?

Our goal is to remove all data points in a DataSource out of a given time interval.

Regards.

Thanks Omar,

yes I'm using the work around, did not finish yet, but I'm a bit concerned on the performance because we need to iterate through all entities.

Regards