1

I have some MVT service generated in GeoServer that are being rendered using OpenLayers 6. The labels are cut off on the edges of the tiles.

This is an example of the MVT request I did in OpenLayers:

new VectorTileLayer({
        className: 'mylayer',
        source: new VectorTileSource({
          url: `${geoserverUrl}/gwc/service/tms/1.0.0/${workspace}:${layername}@EPSG%3A900913@pbf/{z}/{x}/{-y}.pbf`,
          format: new MVT(),
          wrapX: true,
          tileGrid: createXYZ({ maxZoom: 19 }),
        }),
        minResolution: 0,
        maxResolution: 3,
        style: myLayerStyle(),
        renderMode: "hybrid"
      })

The labels when rendered are being cut off in the edges of the tiles, even when setting the gutter parameter in GeoServer to 100px.

After trying to render the same MVTs using MapLibre-GL, the labels are not cropped.

I wonder if this is a limitation of OpenLayers or am I missing something in the creation of the OpenLayers VectorTileLayer above?

Falcoa
  • 2,612
  • 1
  • 20
  • 30
  • You need to specify `declutter: true` in the layer options – Mike Mar 04 '21 at 10:18
  • That doesn't solve the issue. I use it in some of the layers to avoid lots of overlapping geometries, but that does not resolve the issue of cutting off icons and labels on the edges of the tiles. – Falcoa Mar 04 '21 at 10:54
  • It should do. The large labels here https://codesandbox.io/s/vector-tile-info-forked-gidwi are not cropped but if you comment out the `declutter: true` they are. – Mike Mar 04 '21 at 12:39
  • And what about if I need to show all the data even if it's overlapping? In some of the layers I can't use declutter, so no solution? – Falcoa Mar 04 '21 at 21:09

0 Answers0