0

Please imagine a WMS Service (OGC WMS 1.3.0) that offers two layers:

  • POSTAL (post code areas) and
  • ADMIN (administrative areas).

Each layer renders the area outlines, and within each area, it's name as label.

My question: When requesting both layers (...?SERVICE=WMS&REQUEST=GetMap&LAYERS=POSTAL,ADMIN) - is it required to render them independently of each other (possibly leading to overlapping labels in the resulting image), or would it be also valid (according to the OGC spec) to render them in a cross-layer fashion which would offer the opportunity to resolve the overlapping of labels?

2 Answers 2

2

Labelling is a bit of a black art, if you read the WMS/SLD specification closely (or legalistically) then you should render the first layer and then the second layer (or possibly in parallel) and combine the result. So there is a risk of label overlap (both between and within the layers). In fact this is not what most people expect or want when using a WMS so most WMS servers store up the labels and render them in one go at the end so a) no labels are occluded by features on the upper layers, b) labels don't overlap and will often adjust label location to help with these aims.

However, it is often necessary to restrict these optimisations when producing tiles where it is desired for labels to be drawn just once even on tile borders.

4
  • Thanks, I fully agree. The spec says „A WMS shall render the requested layers by drawing the leftmost in the list bottommost, the next one over that, and so on.“. Depending on the layer content, such a „contextless“ stacking of layers may lead to unusable results: Overlapping labels, ugly transitions between segments of differently styled street layers, or similar.
    – user27772
    Apr 21, 2023 at 9:04
  • So I’d also advocate a relaxed interpretation of the spec: Yes, pay attention to the layer ordering, but allow different passes (e. g. one for drawing shapes, one for labeling) and also cross-layer rendering (transitions). Rendered not layer by layer but in a global fashion. Otherwise, the concept of WMS when requesting multiple layers seems to be quite impractical. And if one really needs stacking, layers can, of course, be requested separately.
    – user27772
    Apr 21, 2023 at 9:05
  • that's exactly what GeoServer does, except when run in CITE mode (which is a bit like a VW diesel engine on testing)
    – Ian Turton
    Apr 21, 2023 at 9:42
  • Ah ok, do you have a link on this topic about the default and the CITE mode of GeoServer? I didn't find one at short notice. Thank you.
    – user27772
    Apr 21, 2023 at 11:46
0

Individual layers have individual styles:

...SERVICE=WMS&REQUEST=GetMap&LAYERS=POSTAL,ADMIN&styles=a,b&...

Whether you choose to style them in a similar fashion is up to you.

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.