0

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 (no CORS error), I don’t really understand what is happening. Does anyone know what to do? I don't know if the problem come from Cesium or maybe GeoServer?

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

More information about the geoserver logs :

03 juin 20:38:44 INFO [geoserver.wms] - Request: getMap Angle = 0.0 BaseUrl = http://localhost:8080/geoserver/ Bbox = SRSEnvelope[6.536865234374994 : 6.547851562500002, 44.901123046875 : 44.912109375] BgColor = java.awt.Color[r=255,g=255,b=255] Buffer = 0 Clip = null CQLFilter = null Crs = GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]] Elevation = [] Env = {} Exceptions = SE_XML FeatureId = null FeatureVersion = null Filter = null Format = image/jpeg FormatOptions = {} Get = true Height = 256 Interpolations = [] Layers = [org.geoserver.wms.MapLayerInfo@1deeaf87] MaxFeatures = null Palette = null RawKvp = {REQUEST=GetMap, FORMAT=image/jpeg, SRS=EPSG:4326, BBOX=6.536865234374994,44.901123046875,6.547851562500002,44.912109375, VERSION=1.1.1, STYLES=, SERVICE=WMS, WIDTH=256, HEIGHT=256, LAYERS=scv:epneige_snowpark} RemoteOwsType = null RemoteOwsURL = null Request = GetMap RequestCharset = UTF-8 ScaleMethod = null Sld = null SldBody = null SldVersion = null SortBy = null SortByArrays = null SRS = EPSG:4326 StartIndex = null StyleBody = null StyleFormat = sld Styles = [StyleImpl[ name=epneige_color]] StyleUrl = null StyleVersion = null Tiled = false TilesOrigin = null Time = [] Transparent = false ValidateSchema = false Version = 1.1.1 ViewParams = null Width = 256

4
  • Its very difficult to say without debug information. Does it work OK in geoserver (e.g. in layer preview)? Do you see anything in the geoserver logs? Does the network view in your browser show a successful download? Does that download look like what you expect?
    – BradHards
    Commented Jun 3, 2023 at 9:28
  • Also, where are the transparent and format options coming from?
    – BradHards
    Commented Jun 3, 2023 at 9:31
  • @BradHards Yes everything looks fine in geoserver layer preview and the download is ok too. Everything is on the map and it shows correctly the layer on Cesium. The network shows a successful download and nothing wrong in the geoserver logs. The only thing is that it shows jpeg format but maybe it need to be a png format but I don't know how to change that. Commented Jun 3, 2023 at 18:50
  • Try image/png instead of image/jpeg.
    – BradHards
    Commented Jun 5, 2023 at 9:24

1 Answer 1

1

If you want a transparent image you need to ask for a PNG image rather than a JPEG as those don't support it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.