[Mapserver-users] mapscript::msSaveImage error

Babak Toloue Tehrani babak.tehrani at geosysnet.de
Tue May 20 12:00:05 EDT 2003


Hello,

if you are using the development version (3.7, 4.0) try this:

my $map = new mapscript::mapObj("data/demo37.map") or die('Unable to
OPEN mapfile.');
my $img = $map->draw() or die('Unable to DRAW mapfile.');
$img->save('test37.png');
$img->free();

on 3.6.x use:

my $map = new mapscript::mapObj("data/demo365.map") or die('Unable to
OPEN mapfile.');
my $img = $map->draw() or die('Unable to DRAW mapfile.');
$img->saveImage('testmap.png', $mapscript::MS_PNG,
$map->{transparent},$map->{interlace}, 0);
$img->free();



Am Die, 2003-05-20 um 15.36 schrieb Pedro Salazar:
> Greetings,
> 
> I'm trying to return a image map in my perl mapscript. However, when I
> use the procedure msSaveImage, I got an error on my map script log and
> no image return on my perl script.
> 
> This is my code:
> "
> my $ref_img = $map->drawReferenceMap();
> mapscript::msSaveImage($ref_img,undef,$mapscript::MS_PNG,
>        $map->{transparent},$map->{interlace},undef);
> "
> 
> This is my error output:
> "
> Tue May 20 14:29:57 2003 - msSearchDiskTree(): Unable to access file. 
> Tue May 20 14:29:57 2003 - msSearchDiskTree(): Unable to access file. 
> Tue May 20 14:29:57 2003 - msDrawReferenceMap(): Unable to access file.
> ((null))
> "
> 
> I managed a workaround to solve my problem doing this but I would like
> to avoid this approach:
> "
> my $tmp_file="/tmp/".rand().".png";
> $img->saveImage($tmp_file,$mapscript::MS_PNG, $map->{transparent},
>                 $map->{interlace}, undef);
> system("cat $tmp_file");
> system("rm -f $tmp_file");
> "
> 
> So, I'm interested to know why is that happening (error) and how can I
> solve it.
> 
> Thanks for all your attention,
> Pedro.
-- 
Babak Toloue Tehrani <babak.tehrani at geosysnet.de>




More information about the mapserver-users mailing list