gisgeoservercesiumjswms

Geoserver WMS layer causing white layer to appear on Cesium globe - How to solve?


I have a problem with my cesium globe. I have want to add a layer on the globe with a geoserver wms. The WMS layer appears but it turns the entire globe white. And without the WMS layer everything is normal. I have no error in the console, I don’t really understand what is happening. Does anyone know what to do ?

Here the code I use and a picture of the problem.

Cesium.Ion.defaultAccessToken = 'my access token';

// Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.
var viewer = new Cesium.Viewer('cesiumContainer', {
    geocoder: false,
    animation: false,
    creditsDisplay: false,
    timeline: false,
    fullscreenButton: false,
    terrainProvider: Cesium.createWorldTerrain()
    
}); 

const provider = new Cesium.WebMapServiceImageryProvider({
    url : 'http://localhost:8080/geoserver/wms',
    layers : 'scv:epneige_snowpark',
    transparent: true,
    format : 'image/jpeg',
    proxy: new Cesium.DefaultProxy('/proxy/')
});
const imageryLayer = new Cesium.ImageryLayer(provider);
viewer.imageryLayers.add(imageryLayer); 


    
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(6.568828, 44.922505, 3000),
orientation : {
    heading : Cesium.Math.toRadians(250.0),
    pitch : Cesium.Math.toRadians(-25.0),
}
});

enter image description here


Solution

  • If you want a transparent background you need to ask for a format that supports it, so PNG rather than jpeg.