I am curious if there exists a mechanism where I could use the CZML writer api in such a way as to allow the client to query for a set of data, and then provide essentially paged data. It is highly likely the data set will be significantly large representing 2 ~14 hours sets of data per day for ~30 days of historical data. Is there a means whereby I can give the datasource enough information to begin displaying data, and then have the datasource request more data based on the visible region and time? Hence, changing the camera view and changing the timeline/current time would cause the datasource to request more data. Speaking of the timeline, there must be an event hook you are using for coordinating the timeline and animation widgets, is there anyway these event mechanisms can be exposed? It would be useful to be able to know when the timeline range changes, as well as its limits.
Should I presume the lack of response to mean that this is not possible?
Hey Joshua, I’m looking for something like this too. I have an idea which I’d like to share with the community on implementing the paging, maybe people here can suggest a better approach.
My first idea was to get the tiles that are currently visible, but this involves in getting into Cesium’s private members… Roughly, I thought to iterate over the quadtree each time I detect moveEnd and fetch data from my database by tiles and level. However I think I might have a better take on that, utilizing the existing api.
So, there are Cesium’s ImageryProvider and TerrainProvider. Both are interfaces that share some similar behavior regarding tiles - they are both invoked by the scene when new tiles should be requested and accept a Level, X and Y parameters. So my idea basically is to use a Decorator pattern on either of these classes, so the scene will pass the tile arguments to me and I will manage the data sources as I wish.
This is just a concept which I haven’t yet began to develop or look into it’s problems, but I’m planning to give it a go unless people here convince me otherwise with a better idea. Issues that should be addressed here will include unsubscribing from tiles out of view (maybe after some time passed or distance).
Anyway, it would be great if there would be such paged DataProvider out of the box in Cesium.
Kevin Ring wrote somewhere on the forum about this function that iterates over each rendered tile which can also help you.
viewer.scene.globe._surface.forEachRenderedTile(function(tile) {
// tile.rectangle and tile.level are available here.
});
``
As for my attempt of decorating an ImageryProvider :
Currently I’ve just implemented a custom imagery provider based on TileCoordinatesImageryProvider just to start learning how it works. The first problem I’ve came on of course is that there’s no control hooks of which tiles are unloaded or evicted by the TileProvider. My imagery provider might help do some initialization, but there’s no current easy way but to iterate over each rendered tile and managing it’s state.
I wish we had more control to know which tiles are being loaded, displayed, occluded and finally evicted