Invisible WMS but returns data on click

Hello!

I have a problem I’ve never seen before. I am loading a wms thrugh this code:

  detaljplaner: {
    name: 'Detaljplaner',
    layer: new Cesium.WebMapServiceImageryProvider({
      url: 'myurl',
      layers: 'Detaljplanebestämmelser- ytor',
      parameters: {
        transparent: "true",
        format: "image/png",
      },
    }),
    imageryLayer: undefined,
    tags: ['DP'],

No errors is displayed in the console when i toggle it on. But nothing shows up, however when I click on a location I know there is data over, I get a return and the infobox pops up with the right data.

Has anyone had the same problem before?
I’ve never used this wms in cesiums environment before, only in Origo Map (which is built on open layers and i qgis itself). All my other wms maps comes from geoserver (loaded with the same code but different url) and works fine. This one comes from an application called geodirekt which servers out wms maps from layers in qgis project we have on a server.

My thought are: maybe Cesium can’t handle the styling coming from the qgis project? Have I missed something?

Thanks in advance

Hi @Albnas,

That’s strange. I don’t see why CesiumJS would not be able to render the layer. Would you be able to put together a minimal Sandcastle code example that reproduces the issue so that we can help troubleshoot?

Hi @Gabby_Getz ,

Unfortunately I cannot provide a Sandcastle code example, since the wms service works internally in our environment and I am not allowed to publish it at the moment. But thanks for the reply, since you think CesiumJS would be able to render it I will continue to examine the problem.

Hi @Albnas, I’m serving a WMS from QGIS-server and this code works otherwise it probably has something to do with geodirect environment (?):

const viewer = new Cesium.Viewer('container', options);
const layer = new Cesium.ImageryLayer(
  new Cesium.WebMapServiceImageryProvider({
    url:
      "endpoint",
    layers: "layer shortname in layer settings, qgis-server",
    parameters: {
      transparent: true,
      format: "image/png",
    },
  })
);
viewer.imageryLayers.add(layer);

Hi @mulfvik1, intresting! Maybe it’s something from the geodirekt environment. Any idea what could be the issue? Do you have the geodirekt wms as a background wms or overlay it?

When I config it with transparent: true i simply see the globes color. If i change it to transparent: false I get an all white globe. Either way I still get data return for the infobox on click where I know its data. My WMS works fine in Origos environment.

@Albnas I heard about a case where the getfeatureinfo request sent correct coordinates to the server and got back proper data but the getmap request sent back wms in wrong coordinate system and this was qgis-server. Have you checked if the wms is located on some other position on the globe?

@mulfvik1 Actually I have! It gets easier to see with transparent: false, if I change the view to columbus or 2D I get some brief pixels with other colors, zooming in to these pixel more, I can see the map/data I expect to be present at the location where I get a return on the getfeatureinfo request. But clicking on it returns nothing.
Here is an example (not fully zoomed in):

Are you familiar with any solutions to this? This is the project properties in QGIS:
image
And in the geodirekt admin gui its set to use EPSG:3010.

Ok, so the WMS layer is there at the right position and you can see it. Then the problem might be your syntax and how you call the library, try to define the imageryprovider as imagerylayer parameter as in my example or did that get you the same result?

I’ve had a few problems with WMS using the ol-cesium library and Origo, without any error messaging, but not this one particularly. So I feel for you.

No, the map is not in the right position. I have dubble checked by adding a regular geojson layer over the city. The map (wms) is far off where it should be and when zoomed into, it displays the wms weird.

Maybee its two different issues?
Try to set the “tile buffer in pixels” in QGIS project settings to 128 or value of choice and add tiled: true in parameters object.
Check so that QGIS does’nt reproject automatically and add layer again after this in projects coordinate system. If that does’nt project the layer at correct position it might be that geodirect gui setting

1 Like