Offline mode entities not visible

Hello !

I’m using Cesium 1.130 in an Angular 20 project.

I’d like my Cesium viewer to work entirely offline, without fetching any imagery, tiles, or other resources from the internet.

My goal is to display a GeoJSON map that contains countries and continents (a standard GeoJSON format, which loads correctly and displays all the polygons).

That part works fine — I can see all the countries rendered on the globe.

But, I can’t see my entities appear on the map.

     Cesium.Ion.defaultServer = '';
      const defaultOptions: Cesium.Viewer.ConstructorOptions = {
        terrainProvider: new Cesium.EllipsoidTerrainProvider(),
        timeline: isShowingMapTimeLine,
        animation: isShowingAnimation,
        geocoder: false,
        baseLayer: false,

        // Disable useless button
        baseLayerPicker: false,
        homeButton: false,
        sceneModePicker: false,
        navigationHelpButton: false,
        fullscreenButton: false
      }


      const mergedOptions = { ...defaultOptions, ...options };

      this.viewer = new Cesium.Viewer(containerId, mergedOptions);
      this.viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#202020');
      this.viewer.scene.requestRenderMode = true;
      Cesium.GeoJsonDataSource.load('geojson/countries.geojson',
          {
            fill: Cesium.Color.fromCssColorString('#f70000'),
            stroke: Cesium.Color.WHITE
          }).then(res => {

        this.viewer!.dataSources.add(res);
        console.log('Cesium Viewer initialized.');

        // Remove cesium ion logo
        this.viewer!.cesiumWidget.creditContainer?.parentNode?.removeChild(this.viewer!.cesiumWidget.creditContainer);

        // Set camera view (show france)
        this.viewer!.camera.setView({
          destination: Cesium.Rectangle.fromDegrees(-10, 35, 20, 52),
          orientation: {
            heading: Cesium.Math.toRadians(0.0)
          }
        });
        this.viewerInitializedSubject.next(true);
      });

If I comment this line:

this.viewer!.dataSources.add(res);

My entities appear.

How can I show my geojson datas and all my entities please ?

Thank you very much in advance!

Hi @Kentin_RDG, to help us understand your question, could you please translate the example to JavaScript?

I’m not familiar with this syntax: this.viewer!.dataSources, so it’s hard for me to understand what the expected behavior is.

Hi!

Sure, the syntax this.viewer!.dataSources is just Typescript syntax used in Angular.

This viewer refers to my Cesium Viewer instance.

The exclamation mark is called the non-null assertion operator. It just tells the compiler “Im sure this.viewer is not null or undefined at this point.”