4

WMS standard allows specifying a list of styles for each WMS layer. The users can then use the style name in the URL query parameter "STYLES". If the styles are not specified, "default" is assumed.

But, how do I select such a style in QGIS? I was able to add a WMS server, and add and display its layers. However, although I can see all the styles listed in the "Layer properties", I haven't find any option how to select one.

For example, if some WMS service has a layer named "Vegetation", and for this layer the service defines styles "Grayscale" and "Green", how do I select "Green" instead of the default one?

  • You can colourize the layer in QGIS under Style>Colour Rendering, but that is only of use if the layer is made of simple features and you want to change the colour. The proper answer would involve editing the query parameter as you mention but from what I can see in QGIS you would have to create a new server connection and set up you specific query which included the style – Sethinacan Feb 10 '16 at 12:34
  • My question is about selecting the WMS-provided styles, not coloring the features inside the client. In my case, WMS service is providing raster layers only, and it has internal color mapping and color interpretation functions, which are "exposed" as WMS layer styles. And I want to select such a style, which is provided by WMS service via GetCapabilities request, inside <Layer><Style> tags. – Butl Nor Feb 10 '16 at 13:11
  • Manually editing the URL query parameters is really a last resort, as this would complicate the workflow. Also, in my case, QGIS likes to strip away all the query parameters following the question mark. I guess QGIS, as a WMS conformant app, should be obliged to provide an option to select the style, which is completely standard. – Butl Nor Feb 10 '16 at 13:16
  • Yes, as I said colouring the layer is only useful in some cases, all WMS will be rasters but many I use show a single type of feature such as a flood so colouring is a quick a solution. It seems you are looking for a feature that isn't present maybe? – Sethinacan Feb 10 '16 at 14:08
  • Yes, I am really afraid that this "feature" might not be supported in QGIS. But this is really sad, as the "STYLES" parameter is supported since the beginning of the WMS standard. How can the authors of QGIS forget to implement this parameter, when they properly parse and show the styles from GetCapabilities in the layer properties dialog? Ignorance? I know QGIS is free, and developed by volunteers, but missing such a feature, when implementing thousands of other features, is a no-no. – Butl Nor Feb 10 '16 at 14:24
3

I can't find an example WMS that has a layer with two plus named styles, but just using the below example, I always thought that you would be able to select the layer style you wanted through the QGIS Add Layers dialogue window. So in this below example the style is called 'default' (id is 2), but in your example you would have grayscale (id would be 2) and green (id would be 3) and you would chose whichever style you wanted.

QGIS Add Layers dialogue window

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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