Python mapscript legend

Sean Gillies sgillies at FRII.COM
Sun Mar 6 22:28:50 EST 2005


On Mar 6, 2005, at 4:03 PM, Jon Saints wrote:

> Starting to use python mapscript using the mapserver
> package from the Debian GIS package repository.
>
> All is well, except when trying to render a legen for
> my map.  The legend always appears about 150 pixels
> wide with my label text cut off and covering the key
> image.
>
> My code is:
> myMap = mapObj(PATH_TO_MAP_FILE)
> myMap.legend.height = 1000
> myMap.legend.width = 1000
> img = myMap.drawLegend()
> img.save( img.imagepath + "legend.png" )
>
> Any ideas?
> Thanks
> Jon
>
>

Hi Jon,

I haven't used drawLegend() in a long time, but I did just now confirm
that setting the map.legend.width has no effect on the dimensions of
the output image.  I don't know what's up.  Since mapObj.drawLegend()
is just a very thin facade over a function of libmap, this could be a
deeper bug.

For now, the way to go is to use the classObj.drawLegendIcon()
documented at


http://users.frii.com/sgillies/projects/mapscript/
mapscript.html#classobj

to produce swatches for your classes and do the layout and text in HTML.

cheers,
Sean


--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list