Skip to content

5-4. Categories for a WMS layer

Now we will update the World Cover WMS layer you created in 2-9. Add a WMS data source.

Unlike a COG, a WMS or WMTS service cannot be interrogated for its pixel values — there is no way to sample the underlying data, so the class numbers are not available. Sometimes the WMS services return a legend, but if not (like this one), we can still use the categories tool to create the legend.

You could manually define the categories using the dialogue or import from a CSV in the same way as we did earlier. However, because we already defined a full category set on the COG layer, we can simply copy the category definitions across.

  1. On the Layers tab, expand the World Cover 2021 layer card, go to Data Visualisation → Categories → Edit, and choose Copy from layer and select Austria Land Cover (the COG layer from 5-3. Categories for a COG).

    Edit Categories dialog for the World Cover WMS layer showing populated categories

  2. Save categories to return to the layer card and then Preview. The legend in the Explorer now contains a row per class, using the colours and labels you copied.

    Info

    If in the last tutorial you only edited the class names that the COG populated, you will not have Shrubland or Mangroves here — neither class is present in Austria, so they were never sampled. If you imported the CSV, the full set will be there.

    An alternative for this WMS layer is therefore to import the categories directly from world-cover-classes.csv, as described in 5-3 step 5.

  3. (Optional) Open the categories editor again and untoggle Use category values. Save the layer card and preview. The legend still shows the class labels and colours, but the numeric values are no longer displayed — this reflects the fact that class numbers cannot be read from a WMS or WMTS layer.

  4. (Optional) In the categories editor, change the colour for one of the classes and save. The legend in the Explorer will now show the new colour for that class. However, for WMS / WMTS layers the actual map styling is determined by the service, so the rendered tiles will not change.

See the full WorldCover class lookup in 5-3. Categories for a COG.