Saving legend icon images with python mapscript

Bill Hudspeth bhudspeth at EDAC.UNM.EDU
Thu Aug 5 11:02:44 EDT 2004


I am building a dictionary that loops through map file layers and stores
information about layer attributes. One attribute I want to store is the
URL of the legend icon image for each layer class. In the past, I have
used PHP mapscript to do this with two functions, createLegendIcon() and

$legend_image = $current_class->createLegendIcon(12,12);    // Class
Legend Image object
$legend_info[$ii]['image_url'] = $legend_image->saveWebImage(MS_PNG,1,1,0);

I have found documentation for createLegendIcon() in Python mapscript,
which creates a new image object. I cannot, however, find information on
something analogous to saveWebImage() in Python mapscript. There is some
information regarding the save() and saveImage() functions that operate
on image objects. I am a little unclear about how to use them in such a
way as to avoid passing in a static image filename, as I am processing
these images in a loop structure and don't want to overwrite files. I
would appreciate any information on how I might solve this problem.

Thanks, Bill

More information about the mapserver-users mailing list