WebMapServiceImageryProvider and scale specific styles

Following https://docs.geoserver.org/latest/en/user/styling/sld/reference/rules.html I have been trying to tighten up our Geoserver by adding some MaxScaleDenominators such that fine detail isn’t rendered when viewing the whole country. I promptly realised it was working in QGIS but not in the web browser.

As best I can tell Cesium doesn’t support such for reasons outlined here - WMS layergroup issue

Does anyone have advice on softening the giant crippling query which may result from a user who might not realise the impact of their actions? I expect to be directed back toward Geoserver control flow. I see there is minimumLevel but I am not sure I would be using it as intended.

Many thanks.

@omar is the advice I linked from @Kevin_Ring still current?

I am motivated by https://youtu.be/NCQ5Ba7PRyA?t=1460

I might try the Geoserver mailing list and see if there are any Cesium enthusiasts among them.


@Russell_Grew yes, the problem here is that, unless the camera is pointed straight down, there’s never going to be one single zoom level the map tiles should be loaded at.

With that said, it looks it is possible to pass a maximumLevel to a WMS provider in CesiumJS. I’m testing using this example: https://sandcastle.cesium.com/index.html?src=Web%20Map%20Service%20(WMS).html.

If you pass maximumLevel: 5 and zoom in you can see the imagery stops resolving much earlier than omitting that. I’m not familiar with how GeoServer’s “MaxScaleDenominators” work though.Does using these min/max options not provide the expected behavior?

Hi @omar,

I am relatively new to geospatial.

Following your helpful sandcastle example the goal is for the points to vanish when looking at the whole country, and only appear if one is sufficiently zoomed in. I don’t think I can accomplish this with maximum or minimum levels.

The motivation is to avoid rendering “heaps of points” as the process for this is likely resource intensive.

I did find some information about how different 2D software uses different conventions for zoom and scale. eg: https://youtu.be/jwMNKPUL2iw?t=1616 and the joys of going between them.

Using the link from the video the OSM WMS has features which are zoom dependent (roads, place names, etc). So I think my work needs to happen on the Geoserver side. I will explore this.

// Add a WMS imagery layer
var imageryLayers = viewer.imageryLayers;
  new Cesium.WebMapServiceImageryProvider({
    layers: "osm:osm",
    parameters: {
      transparent: true,
      format: "image/png"

Or https://nationalmap.gov.au/#share=s-9WwxLcXorsQTZLVk4H88wKyC1Bu if you are interested.

Thanks for the help!

It turns out I can use MaxScaleDenominator as intended, with Cesium.

I inherited some layer styles and made some assumptions about when the layer visibility would trigger. These turned out to be false. The tip is to check the Scale in QGIS or similar to get a feel for when it should be activated.

1 Like