Usage of offline terrain contents in Android App based on Cesiumjs & Cordova

Good Afternoon,

I’am trying to investigate the use of offline contents inside an Android App based on Cesiumjs and Cordova.

For Imagery and 3D Tiles, the first tests are not so bad, but for the terrain tiles, I am facing issue at the ArrayBuffer fetch level of a content (value exceeded Int limit )

If I use the same contents from a terrain tile server, this is working.

I presume that is related to the way a terrain tile is downloaded from the server (“Content-Encoding gzip;Content-Disposition attachment;”) which is not applicable as-is on local file reading.

Is there a way to serve local terrain tiles using file:// using existing Cesiumjs API or some new solution has to defined. ?

Thanks;

Best regards;
Pascal

Hi Pascal,

Serving terrain requires a special configuration designed to handle terrain requests.

Though not offline, we do have a service, Cesium ion, which can process, host, and serve your terrain data.

If you need an totally offline solution there are some available. Contact Tim for more information.

Thanks,

Gabby

Hi Gaby;

Thanks for the feedback, my concern is about real offline mode where some tiles, terrain and images are on the device to allow to work without internet connexion (or with low bandwith).

Cloud distributed data offer by Cesium ion or on premise solution as also you can propose require a network access which is not so bad in bandwith, but it is not always the case in real life for some scenario.

To support a minimised set of use cases, it can be useful to have onboard some data to optimize available 4G bandwith if any ( will be an another story with 5G).

In between, I have succeed to manage offline some of my terrain dataset by doing a small code update to apply a gunzip on the read contents for url starting with file:// ( in http, this is done on the fly by the web client).

After some tests, I will potentially share it as pull request it there is an interest for others.

Best regards;

Pascal

Hi Pascal,

Just be careful- Some imagery does not provide the rights to use in an offline context. Natural Earth II is the one we include in Cesium that is allowed.

Additionally, while streaming may be slow initially, after once loaded, requests will be cached on the device so repeated requests will be faster.

The on-prem solution still requires a server, correct. You may be able to configure a custom solution for loading terrain tiles locally, but that behavior is not part of Cesium. If you have an example, please feel free to post it once it’s ready!

Thanks!

Gabby