0

I am using MapLibre to make tiled WMS GetMap request to GeoServer. The SLDs I am using for labels have Partials=True, maxDisplacement=256, autoWrap=163, spaceAround=1. For most request, the labels are properly being split across the tiles (256x256). However I am still encountering labels that are not being displayed on both tiles. I have tried setting the the WMS GetMap request parameters for tiled and buffer. Given the SLD vendor options above, I think a buffer of 256 (maxDisplacement) + 256 (fully covering an adjacent tile) + 163 (max label length) + 4 * 1 (spaceAround on both sides for two labels) = 679 should ensure that all labels are rendered, but this is not the case in at least one instance.

The request query string looks like:

SERVICE=WMS
&VERSION=1.3.0
&REQUEST=GetMap
&FORMAT=image/png
&TRANSPARENT=true
&CRS=EPSG:3857
&FORMAT_OPTIONS=dpi:90
&width=256
&height=256
&buffer=679
&tiled=true
&tilesorigin=-10945943,3378358.25
&LAYERS=<various-layers>
&STYLES=<various-styles>
&bbox=<bbox-epsg-3857>

An example of the labels being truncated:

Truncated labels

On the left side of the blue line, the label should read '2" APCS' and similarly in the right it should read '2" APCS' (the 6' N on the right is just on the other side of a tile boundary). When the layer containing the "6' N" labels is turned off, the label on the left is shifted more toward the center of it's line and display correctly (the not crossing any tile boundaries), and the label on the right is correctly split across tiles.

Edit: Zooming in further on the left I find the label being shown on both tiles, but not at the same position, resulting in this:

Improper stitching

So it looks like the SLD renderer is not catching the 6' N (which uses the default PointPlacement for it's label, not LinePlacement like 2" APCS) on adjacent tiles.

I've tried messing around with a few other settings, but I would think with an excessively large buffer (I've tried up to 4000), it should calculate the position of the labels the same in the adjacent tiles, which it doesn't seem to be doing.

More generally, I am looking for a way/buffer size that would guarantee (using certain vendor options, such as a given maxDisplacement and autoWrap) to catch all labels in adjacent tiles.

1 Answer 1

1

Using partials will only work if the position of the label is fixed so that the 2 (or more) parts can align over the tile edges. If you allow the label engine to move labels then you will get problems, so take maxdisplacement out and specify a fixed point such as the centroid of the line as the geometry for the label.

2
  • Ok, while I don't know if I will look at it any time soon (if ever), do you happen to know where the partials logic (and/or buffer logic) is in the geoserver code? It would be more time consuming and complicated, but I don't see why the code couldn't be extended to calculate the position of labels including maxdisplacement (i.e. sort of like using overlapping metatiles)
    – John
    Nov 11, 2022 at 15:42
  • that is because each tile request is a separate transaction and may be on a different machine than the neighbouring one for speed.
    – Ian Turton
    Nov 11, 2022 at 16:09

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.