Tile loading progress

Does CesiumJS have a way to let the user know the progress of the tiles that are being loaded?

There are different functions in the Cesium3DTileset that allow the user to track different sorts of loading information.

The following is just a rough summary. Refer to the documentation for details:

  • readyPromise: A promise that will be fulfilled when the tileset.json has been loaded
  • initialTilesLoaded is called once, roughly, ~“after the window has been opened”, when the tiles for the initial view configuration have been loaded
  • allTilesLoaded is called whenever all tiles for the current view have been loaded (i.e. when you move the camera, Cesium may load higher-resolution tiles for the new view, and when these have been loaded, this event is fired)
  • loadProgress may be closest to what you are looking for: The event fires and provides some internal information about the number of tiles that are still being processed.

The loadProgress function provides information from which you can derive the information that ‘all tiles are loaded’: When there are no more pending/processed requests, then ‘all tiles are loaded’, and this also causes allTilesLoaded to be fired.

Here is a Sandcastle that shows the output of all these functions. Note that when zooming and panning the view, new tiles may be loaded, and the progress is printed to the console.