Generating Legend Image with Python Mapscript

Tamas Szekeres szekeres.tamas at FREEMAIL.HU
Tue Sep 27 15:44:55 PDT 2005


On Tue, 27 Sep 2005 17:32:46 -0500, Tamas Szekeres
<szekeres.tamas at FREEMAIL.HU> wrote:

>On Tue, 27 Sep 2005 16:16:23 -0600, Sean Gillies <sgillies at FRII.COM>
wrote:
>
>>On Sep 27, 2005, at 4:05 PM, Tamas Szekeres wrote:
>>
>>> On Tue, 27 Sep 2005 10:07:35 -0600, Sean Gillies <sgillies at FRII.COM>
>>> wrote:
>>>
>>>>
>>>> Bill,
>>>>
>>>> Consider using classObj.drawLegendIcon() to create an image only and
>>>> then do the text labeling with ReportLab or whatever.
>>>>
>>>> cheers,
>>>> Sean
>>>>
>>>> --
>>>> Sean Gillies
>>>> sgillies at frii dot com
>>>> http://zcologia.com
>>>
>>>
>>> Sean,
>>>
>>> How can I create an empty imageObj with a certain background color in
>>> order to pass to classObj.drawLegendIcon() as a parameter?
>>>
>>>
>>> Tamas Szekeres
>>>
>>>
>>
>>Tamas,
>>
>>My earlier suggestion was slightly off. classObj.createLegendIcon()
>>will create an icon for the class, using the map's legend.imagecolor as
>>the background color.
>>
>>Sean
>
>
>Sean,
>
>It would be desirable to set the legend key image size smaller than the
>legend image, otherwise some of the images will be clipped (eg thick
>lines). classObj.createLegendIcon() does not support this separation.
>
>
>Tamas Szekeres



This problem could be solved by creating the an imageObj with an empty
classObj using classObj.createLegendIcon(), and calling drawLegendIcon of
the layer's class with this previously created image and smaller size. But
it seems to be a hack.

Tamas Szekeres



More information about the MapServer-users mailing list