CesiumJS/iON in an "offline" environment

I’m trying to get the latest Cesium working within an environment behind firewall. We have our own tile server. I was wondering if Cesium iON works in that type of environment. If so, can you please provide snippet configurations? Looking from the Network tab, it seems like it’s always trying to reach out to api.cesium.com. We can’t get to that site.

I am using v1.62.0.

You can specify your own tile server instead of the default Cesium ion. This code example shows you how to use the built-in imagery layer and turn off the geocoder (which also uses Cesium ion) so this will work completely offline:

This shows an example of loading an imagery layer from a separate URL:

You can also get Cesium ion’s imagery and global 3D terrain to use offline/behind your firewall with an on-premise license, see:

https://cesium.com/geospatial-content-server/

Thanks, Omar. The links/examples you’ve posted was very helpful. I’ll ask a more specific question based on that.

The example for loading an imagery layer from separate URL use case is what I need exactly. However, if you look at the Network activities for Cesium. You’ll see in the Network tab that it is attempting to make a call to https://api.cesium.com/v1/assets/2/endpoint to authenticate based on the accessToken. That said, what if I can’t get to that URL? It seems like if that call is not successful, then everything after stops. Which in turn means no image/globe gets rendered.

So my specific question is… is there a way to get around/passed that? Or does the latest version always require an accessToken key that’s valid and needs to be authenticated to that url?

If you’re adding your own layer on top of CesiumJS’s base layer, then it will still be contacting the Cesium ion server for the base layer. So make sure to either replace the base layer with the offline imagery (like in the offline example) or remove the base layer before adding your own.

See also the “common mistakes” section on this page, which explains that constructing the viewer with the default options will load the Cesium ion Bing imagery by default, so that will show you a request to the ion servers in the network tab, even if the layer in the next frame, but that shouldn’t prevent the globe from rendering:

https://cesium.com/docs/tutorials/optimizing-quotas/

I’m getting the same issue having added at the start of my js file the following:

var viewer = new Cesium.Viewer(‘cesiumContainer’,{
imageryProvider: false,
baseLayerPicker: false,
geocoder : false
});
viewer.imageryLayers.addImageryProvider(new Cesium.TileMapServiceImageryProvider({
url : Cesium.buildModuleUrl(‘Assets/Textures/NaturalEarthII’),
}));

When I disconnect my computer (no internet, no wireless, completely off line) I get a message starting : " Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.cesium.com/v1/assets"

Clearly, in spite of entering code that should prevent calls to the internet, I’m getting calls to the internet. As I’m trying to replicate an environment with no access to the outside world, the error message (and the resulting lack of world imagery) is a bit of a problem. If anyone can steer me in the right direction, I’d appreciate it.

import Ion from “cesium/Source/Core/Ion”

Ion.defaultServer=’’

do not use a terrainProvider on viewer

That did the trick. There were a couple of modifications to get it to run (adding "type=“module” " in the html line making the call to this js file, adding “.js” to the import line for the Ion.js file), and now it will run completely offline. Thank you. Greatly appreciated.