[mapserver-dev] Legend images and scale factor

Tamas Szekeres szekerest at gmail.com
Fri Sep 24 13:19:35 PDT 2021


Hi All,

Looks like we’ve been struggling for years with how the legend images
should be drawn properly, especially when the symbol sizes are changing
along with the scale, for example when the SIZEUNITS is set to METERS in
the layer definition. One of the recent commit
<https://github.com/MapServer/MapServer/pull/6359/commits/3a49bab2da26fef4e7d28fffb2b754897abfbf6c>
related to this forcibly sets the scale factor to 1.0 when the size units
is not PIXELS. But I don't think this is a reasonable solution in all cases.

1. It overrides the implementation which attempts to set the scale factor
in the mapscript drawLegendIcon
<https://github.com/MapServer/MapServer/blob/1c14821bc4c6fc10e966fd05230ad71c05817c7d/mapscript/swiginc/class.i#L165>
.
2. It requires to define the size/widths in pixel sizes in the CLASS/STYLE
definitions, so I cannot set a symbol size to 100m for example or a line
width to 20m because it would cause giant symbol sizes in the legend images
according to the current implementation.

So what folks would think how should we set the scale factor in legend
properly? At first glance I might think the symbol sizes in the legends
should look exactly like the sizes on the map to avoid confusion. So if I
set the symbol size to 10m to draw a polygon outline and it is 1 pixels on
the map, I would draw the polygon outline with 1 pixel width on the legend,
too.

However it also seems to be a valid use case to display the symbols at
constans sizes for example to utilize the SYMBOLSCALEDENOM setting or
specify something different, like a new LEGENDSCALEDENOM whatever.

In any case, we would definitely want to specify the scale factor either
explicitly or implicitly from the mapscript API, but that is not the case
anymore in the mapserver 7.6.4 or above.


Best regards,

Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20210924/af7cdb53/attachment.html>


More information about the MapServer-dev mailing list