0

I'm using OpenLayers to consume various public WMS services. Out of 13 services, I'm encountering issues with two of them.

For the first service, there is a style named "inspire_common:DEFAULT". This name is what I obtained from the GetCapabilities request, so I presumed that I could request it. However, when I do, I receive an error message saying "WMS server error. Style (inspire_common:DEFAULT) not defined on layer." When I request just "DEFAULT", it works. Is it necessary to check for colons in the style name?

The second issue involves another service that does not accept "LAYERS" as a parameter name, but instead accepts "LAYER", without an "S". Is there a way to verify this beforehand?

Interestingly, neither of these issues are present when I consume these services in QGIS. Can anyone provide insights on how to resolve these issues?

Style: inspire_common:DEFAULT

https://www.gds-srv.hessen.de/cgi-bin/lika-services/ogc-free-images.ows?language=ger&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS

5
  • 1
    We need the URLs - but LAYER is wrong so you'll need to get the owner to fix it
    – Ian Turton
    Commented Jul 21, 2023 at 16:17
  • just added the one with the style name
    – BR75
    Commented Jul 22, 2023 at 5:07
  • If you want the default style there's no need to name it, you can use just STYLES&. If you want to use a named style then you need to use the exact name string, including colons if they exist.
    – nmtoken
    Commented Jul 25, 2023 at 12:34
  • LAYER is correct in the GetCapabilities response, but in a GetMap or GetFeatureInfo request the parameter is LAYERS
    – nmtoken
    Commented Jul 25, 2023 at 12:36
  • If the service works in QGIS, but not in OpenLayers then the issue would appear to be with the requests generated by OpenLayers and not with the server.
    – nmtoken
    Commented Jul 25, 2023 at 12:40

1 Answer 1

1

First, the WMS specification is clear that LAYER is wrong the parameter must be LAYERS so the owner needs to fix that one.

The inspire_common:DEFAULT style seems to only be mentioned for the outer wms_he_dop "layer" which is a container for the other layers rather than a layer that should be displayed. All the inner layers use a default style which is an odd name to choose but it seems to work, in fact QGIS is avoiding this by just leaving the STYLES parameter blank which forces the server to use the default style.

1
  • Thanks for clearing that up. In my app, I flatten the layers so users always have one layer with one or more styles to pick from. The style they can choose is tied to that layer. To avoid this issue, should I only let users select styles if there's more than one and not make the first one selectable at all?
    – BR75
    Commented Jul 22, 2023 at 16:42

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.