WMTS Legend Size

Hello,

When using a GeoServer layer in QGIS, the legend size is displayed differently when using WMS vs WMTS. While the WMS legend is looking just fine, the WMTS one is reaaaally long. The layer itself is a GeoTIFF layer with an SLD style (created in QGIS) applied to it.

Here are the GetLegendGraphic entries in QGIS for the layer :

With WMS:
http://localhost:8080/geoserver/ows?service=WMS&version=1.3.0&request=GetLegendGraphic&format=image/png&width=20&height=20&layer=workspace:layer

With WMTS:
http://localhost:8080/geoserver/ows?service=WMS&request=GetLegendGraphic&format=image/png&width=75&height=903&layer=workspace:layer

I get the same width and height numbers when inspecting the WMS and WMTS GetCapabilities XML on the GeoServer front webpage.

My goal is to be able to control the legend size for WMTS layers. How can I do that?

EDIT:The GeoServer version is 2.26.1 installed on a Windows 2019 Server using the Windows Installer.

Thanks!

Hello.

I found the GeoWebCache documentation saying that Styles Legends are automatically configured for GeoServer layers. The documentation says the following:

Both REST interface and geowebcache.xml configuration file use the same XML structure. A legend configuration is associated with a certain style in the context of a certain layer

… continuing to say that the width and height properties can be used to configure a legend info.

My issue with this is that I don’t know where to access it. geowebcache.xml file found in ProgramData\GeoServer\gwc folder only has gridsets listed in it. Am I supposed to add the layers myself using this geowebcache.xml as an example?

Thanks!