[mapserver-dev] Legend images and scale factor

Richard Greenwood richard.greenwood at gmail.com
Thu Oct 7 17:52:11 PDT 2021


I have struggled with legend scale. I usually resort to KEYIMAGE which is a
pain. I like the idea of LEGENDSCALEDENOM.

On Thu, Oct 7, 2021, 8:03 AM Steve Lime <sdlime at gmail.com> wrote:

> I've always preferred the constant sizes in legends, simpler for my users
> that way but I can see your use case. Something like LEGENDSCALEDENOM could
> be useful. Are you proposing something be added to the legendObj? Could
> maye just use SYMBOLSCALEDENOM there?
>
> On Fri, Sep 24, 2021 at 3:19 PM Tamas Szekeres <szekerest at gmail.com>
> wrote:
>
>> 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
>>
>> _______________________________________________
>> MapServer-dev mailing list
>> MapServer-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>
> _______________________________________________
> MapServer-dev mailing list
> MapServer-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20211007/9cdd1e91/attachment.html>


More information about the MapServer-dev mailing list