How to disable the error of access token when run offline?


I work with cesium in offline mode.

So i create the viewer object with:
Geocoder: false,
ImageryProvider: null (because i use typescript it cant be false but only null)
And more…

I got the error:


Now, i see that its the default ion access token, and i have the error because i work offline.

How to disable it? I dont want to see this error and even dont want send http GET to when i work offline.

Please help how to solve it!

Thanks in advance.

I stumbled on this issue when cesium ion was set up, it seems that if you don’t give any imagery provider to your viewer it defaults to ion, hence the message. I got around this by giving it a very simple imagery provider at viewer creation, that I replace when my assets are loaded.

// create dummy imageryProvider to avoid annoying cesium ion API key message
imageryProvider : new Cesium.TileMapServiceImageryProvider({
	url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')

@char thank you for the answer!!! I will try it…

You can alternatively disable the imagery provider like this:

var viewer = new Cesium.Viewer('cesiumContainer',{
    imageryProvider: false,
    baseLayerPicker: false

From this article: Understanding and Optimizing Cesium ion Quotas |

Note that your app will still use Cesium ion’s geocoder by default. To turn off all cloud features see the “Offline” Sandcastle example: Cesium Sandcastle

1 Like

@omar @char I test it right now and it works!!! Thank you very much!!! :slight_smile: