Saving legend icon images with python mapscript

Lowell Filak lfilak at MEDINACO.ORG
Thu Aug 5 11:21:48 EDT 2004


You can save to any image name you create to avoid overwriting files.
In perl I use parts of localtime + process id (hmmm... which I supose
will need to change for mod_perl):
my $sfile = "T$hr$min$sec$spid";
$image->save("$sfile.png");

HTH

Lowell

The following message was sent by Bill Hudspeth <bhudspeth at EDAC.UNM.EDU>
on Thu, 5 Aug 2004 09:02:44 -0600.

> Hello,
>
> 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
> saveWebImage():
>
> $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